标题开启docker远程访问
输入vi /usr/lib/systemd/system/docker.service
Documentation=https://docs.docker.com
BindsTo=containerd.service
After=network-online.target firewalld.service containerd.service
Wants=network-online.target
Requires=docker.socket
[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
# 将原来的替换为现在这句,开放2375端口
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H fd:// --containerd=/run/containerd/containerd.sock
修改后保存退出
执行以下命令
#刷新配置
systemctl daemon-reload
#重启docker
systemctl restart docker
输入 netstat -anp | grep 2375
可以看到2375是被监听到了
[root@jk ~]# netstat -anp | grep 2375
tcp6 0 0 :::2375 :::* LISTEN 866/dockerd
这样就开启远程访问了