Docker 打开 TCP 端口
Docker 打开 TCP 端口
Docker 打开 TCP 端口
原文链接:https://www.lucien.ink/archives/440/
1. 开启 TCP 端口
1.1 创建目录/文件
1
2
3
4
5
6
mkdir -p /etc/systemd/system/docker.service.d
cat > /etc/systemd/system/docker.service.d/tcp.conf <<EOF
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375
EOF
1.2 重启 docker 进程
1
2
systemctl daemon-reload
systemctl restart docker
1.4 查看端口是否打开
1
ps aux | grep dockerd | grep -v grep
2. 关闭 TCP 端口
1
2
3
4
rm -f /etc/systemd/system/docker.service.d/tcp.conf
systemctl daemon-reload
systemctl restart docker
ps aux | grep dockerd | grep -v grep
This post is licensed under CC BY 4.0 by the author.