1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| vim /lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock 将管理地址写入 /etc/profile 执行命令:echo 'export DOCKER_HOST=tcp://0.0.0.0:2376' >> /etc/profile 执行命令:source /etc/profile
重启服务 执行命令: systemctl daemon-reload && systemctl restart docker
{ "hosts": ["tcp://0.0.0.0:2376","unix:///var/run/docker.sock"] } systemctl daemon-reload && systemctl restart docker
vim /lib/systemd/system/docker.service ...
ExecStart=/usr/bin/dockerd --containerd=/run/containerd/containerd.sock ... systemctl daemon-reload systemctl restart docker
curl 127.0.0.1:2376/version http://10.0.0.102:2376/version
|