Docker 开启API
Docker默认文件位置:
/usr/lib/systemd/system/docker.service
cd /usr/lib/systemd/system/ vim docker.service
修改
[Service]
区ExecStart
行为下面的内容
[Service] Type=notify # the default is not to use systemd for cgroups because the delegate issues still # exists and systemd currently does not support the cgroup feature set required # for containers run by docker ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock --containerd=/run/containerd/containerd.sock ExecReload=/bin/kill -s HUP $MAINPID TimeoutSec=0 RestartSec=2 Restart=always
在原本的
ExecStart
中添加tcp://0.0.0.0:2375
重启
docker 守护进程
和docker.service
systemctl daemon-reload systemctl restart docker.service systemctl start docker.service