服务器端 开启 docker 远程访问


vi /lib/systemd/system/docker.service

ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock


 
ExecStart=/usr/bin/dockerd  -H tcp://0.0.0.0:2375 -H fd:// --containerd=/run/containerd/containerd.sock


systemctl daemon-reload

systemctl restart docker

# 本地 测试 
curl http://localhost:2375/version


# 其他 机器 测试
curl http://192.168.164.190:2375/version

本地 远程连接 docker


docker context  create  --docker "host=tcp://your-remote-server.org:2376"

docker context  create  remote_190  --docker "host=tcp://192.168.164.190:2375"
context "remote_190" already exists

docker context  update  remote_190  --docker "host=tcp://192.168.164.190:2375"
remote_190
Successfully updated context "remote_190"

docker context use remote_190

# 即可 使用 远程 docker

欢迎大家一起交流呀
qq群:3638803451
vx:wxid_sgdelhiwombj12


乐码客
1 声望1 粉丝