linux 测试成功
cat > /etc/systemd/system/docker.service.d/tcp.conf <<EOF
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375
EOF
另外一种:未测试
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
区别:
-H fd:// 仅Ubuntu可用
-H unix:///var/run/docker.sock CentOS和Ubuntu通用
未测试
启动
systemctl daemon-reload
systemctl restart docker
看端口监听
CentOS7还可以通过修改/etc/sysconfig/docker文件中的 OPTIONS来达到同样的目的
OPTIONS='--selinux-enabled -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375'
关闭端口监听
rm /etc/systemd/system/docker.service.d/tcp.conf -rf
systemctl daemon-reload
systemctl restart docker
ps aux |grep dockerd