docker自带api接口,需要手动开启。
这里是yum安装的docker,版本是1.12
[root@localhost ~]# vi /lib/systemd/system/docker.service ExecStart=/usr/bin/dockerd-current \ --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current \ --default-runtime=docker-runc \ --exec-opt native.cgroupdriver=systemd \ --userland-proxy-path=/usr/libexec/docker/docker-proxy-current \ $OPTIONS \ $DOCKER_STORAGE_OPTIONS \ $DOCKER_NETWORK_OPTIONS \ $ADD_REGISTRY \ $BLOCK_REGISTRY \ $INSECURE_REGISTRY\ $REGISTRIES\ # 不要忘记此换行 -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2222 # 添加的
# 重启docker服务
[root@localhost ~]# service docker restart
Redirecting to /bin/systemctl restart docker.service
Warning: docker.service changed on disk. Run ‘systemctl daemon-reload’ to reload units.
# 提示先执行 systemctl daemon-reload
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# service docker restart
Redirecting to /bin/systemctl restart docker.service
[root@localhost ~]# netstat -tnlp | grep 2222
tcp6 0 0 :::2222 :::* LISTEN 5750/dockerd-curren
原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/3978.html