一、修改docker.service文件
1、编辑docker文件
vi /lib/systemd/system/docker.service
2、ExecStart属性添加参数
-H tcp://0.0.0.0:2375
ExecStart属性添加参数
二、重启
1、加载docker守护线程
systemctl daemon-reload
2、重启docker
systemctl restart docker
三、测试是否开启成功
curl http://localhost:2375/version
root@iZwz9f4eh9lmah6qiq41zvZ:~# curl http://localhost:2375/version
{"Platform":{"Name":"Docker Engine - Community"},"Components":[{"Name":"Engine","Version":"20.10.12","Details":{"ApiVersion":"1.41","Arch":"amd64","BuildTime":"2021-12-13T11:43:36.000000000+00:00","Experimental":"false","GitCommit":"459d0df","GoVersion":"go1.16.12","KernelVersion":"4.15.0-166-generic","MinAPIVersion":"1.12","Os":"linux"}},{"Name":"containerd","Version":"1.4.12","Details":{"GitCommit":"7b11cfaabd73bb80907dd23182b9347b4245eb5d"}},{"Name":"runc","Version":"1.0.2","Details":{"GitCommit":"v1.0.2-0-g52b36a2"}},{"Name":"docker-init","Version":"0.19.0","Details":{"GitCommit":"de40ad0"}}],"Version":"20.10.12","ApiVersion":"1.41","MinAPIVersion":"1.12","GitCommit":"459d0df","GoVersion":"go1.16.12","Os":"linux","Arch":"amd64","KernelVersion":"4.15.0-166-generic","BuildTime":"2021-12-13T11:43:36.000000000+00:00"}
root@iZwz9f4eh9lmah6qiq41zvZ:~#
网友评论