CentOS之docker开启远程连接

第一步,新建docker-tcp.socket

vi /etc/systemd/system/docker-tcp.socket

第二步,编辑内容

[Unit]
Description=Docker Socket for the API

[Socket]
ListenStream=2375
BindIPv6Only=both
Service=docker.service

[Install]
WantedBy=sockets.target

第三步,开启服务

systemctl enable docker-tcp.socket(设置开机启动)
systemctl stop docker
systemctl start docker-tcp.socket
systemctl start docker

最后测试一下

docker -H tcp://127.0.0.1:2375 ps

你可能感兴趣的:(CentOS之docker开启远程连接)