Centos7開啟Docker遠端訪問
阿新 • • 發佈:2018-12-12
Centos7
- 在/usr/lib/systemd/system/docker.service,配置遠端訪問。
# vim /usr/lib/systemd/system/docker.service
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
- docker重新讀取配置檔案,重新啟動docker服務
# systemctl daemon-reload
# systemctl restart docker
- 驗證
# ps -ef|grep docker root 26208 1 0 23:51 ? 00:00:00 /usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
# netstat -tulp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN 886/sshd tcp6 0 0 [::]:2375 [::]:* LISTEN 26208/dockerd
$ sudo docker -H tcp://139.129.130.123:2375 images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 5.6 f8fe303bcac2 4 days ago 298MB
注意防火牆是否開啟