1.修改docker服务文件 vim /usr/lib/systemd/system/docker.service
2.修改ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H fd:// --containerd=/run/containerd/containerd.sock
3.保存退出后重启docker systemctl daemon-reload systemctl restart docker
python远程连接docker
1.pip install docker
2.client = docker.DockerClient(base_url='tcp://ip:2375')
网友评论