Docker 开启2375端口提供外部访问

Docker 开启2375端口提供外部访问1、编辑docker.service#vim/usr/lib/systemd/system/docker.service在ExecStart=/usr/bin/dockerd-current后增加-Htcp://0.0.0.0:2375-Hunix://var/run/docker.sock[Unit]Description=DockerApplicationContainerEngineDocumentation=https://docs.docker.c..

大家好,又见面了,我是你们的朋友全栈君。

Docker 开启2375端口提供外部访问

1、编辑docker.service

# vim /usr/lib/systemd/system/docker.service

在 ExecStart=/usr/bin/dockerd-current 后 增加

-H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service containerd.service
Wants=network-online.target
Requires=docker.socket containerd.service

[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 fd:// --containerd=/run/containerd/containerd.sock -H tcp://0.0.0.
0:2375 -H unix://var/run/docker.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always

# Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
# Both the old, and new location are accepted by systemd 229 and up, so using the old location
# to make them work for either version of systemd.
StartLimitBurst=3

# Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.
# Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
# this option work for either version of systemd.
StartLimitInterval=60s

2、重启docker,重新读取配置文件,重新启动docker服务

# systemctl daemon-reload

# systemctl restart docker

[root@docker-servers ~]# systemctl daemon-reload
[root@docker-servers ~]# systemctl restart docker
[root@docker-servers ~]# netstat -tunlp | grep 2375
tcp6       0      0 :::2375                 :::*                    LISTEN      96681/dockerd

3、开放防火墙端口

# firewall-cmd –zone=public –add-port=2375/tcp –permanent

[root@localhost ~]# firewall-cmd --zone=public --add-port=2375/tcp --permanent
success

如果您使用的是云服务器,您还需要打开对应的云服务器安全组,在安全组里面配置对应的端口才行。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/142095.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号