开启方法:
1、修改/etc/default/docker下的配置
cat /etc/default/docker
DOCKER_OPTS="-H tcp://0.0.0.0:2375"
systemctl restart docker
2、修改/usr/lib/systemd/system/docker.service配置
cat /usr/lib/systemd/system/docker.service
[Service]
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
systemctl daemon-reload && systemctl restart docker
3、在/etc/docker/daemon.json文件下增加一行
cat /etc/docker/daemon.json
{
"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]
}
systemctl daemon-reload && systemctl restart docker
查看进程是否打开2357端口
测试
docker -H tcp://本机ip:2375 version
1、"unix:///var/run/docker.sock":unix socket,本地客户端将通过这个来连接 Docker Daemon
2、"tcp://0.0.0.0:2375":tcp socket,表示允许任何远程客户端通过 2375 端口连接 Docker Daemon