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

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

# systemctl daemon-reload

# systemctl restart docker

[root@docker-servers ~]# systemctl daemon-reload

[root@docker-servers ~]#

[root@docker-servers ~]#

[root@docker-servers ~]# systemctl stop docker

[root@docker-servers ~]#

[root@docker-servers ~]#

[root@docker-servers ~]# systemctl start docker

[root@docker-servers ~]# netstat -tunlp | grep 2375tcp0 0 :::2375 :::* LISTEN 4046/dockerd-curren

3、开放防火墙端口

# firewall-cmd --add-port=2375/tcp

# firewall-cmd --add-port=2375/tcp --permanent

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

success

[root@localhost~]#

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

success

4、附上docker.service文件

Docker version 1.13.1

[root@docker-servers ~]# docker -v

Docker version1.13.1, build 7f2769b/1.13.1[root@docker-servers ~]#

[root@docker-servers ~]#

[root@docker-servers ~]# cat /usr/lib/systemd/system/docker.service

[Unit]

Description=Docker Application Container Engine

Documentation=http://docs.docker.com

After=network.target

Wants=docker-storage-setup.service

Requires=docker-cleanup.timer

[Service]

Type=notify

NotifyAccess=main

EnvironmentFile=-/run/containers/registries.conf

EnvironmentFile=-/etc/sysconfig/docker

EnvironmentFile=-/etc/sysconfig/docker-storage

EnvironmentFile=-/etc/sysconfig/docker-network

Environment=GOTRACEBACK=crash

Environment=DOCKER_HTTP_HOST_COMPAT=1Environment=PATH=/usr/libexec/docker:/usr/bin:/usr/sbin

ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock \

--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 \--init-path=/usr/libexec/docker/docker-init-current \--seccomp-profile=/etc/docker/seccomp.json \

$OPTIONS \

$DOCKER_STORAGE_OPTIONS \

$DOCKER_NETWORK_OPTIONS \

$ADD_REGISTRY \

$BLOCK_REGISTRY \

$INSECURE_REGISTRY \

$REGISTRIES

ExecReload=/bin/kill -s HUP $MAINPID

LimitNOFILE=1048576LimitNPROC=1048576LimitCORE=infinity

TimeoutStartSec=0Restart=on-abnormal

KillMode=process

[Install]

WantedBy=multi-user.target

原文件如下:

[Unit]

Description=Docker Application Container Engine

Documentation=http://docs.docker.com

After=network.target

Wants=docker-storage-setup.service

Requires=docker-cleanup.timer

[Service]

Type=notify

NotifyAccess=main

EnvironmentFile=-/run/containers/registries.conf

EnvironmentFile=-/etc/sysconfig/docker

EnvironmentFile=-/etc/sysconfig/docker-storage

EnvironmentFile=-/etc/sysconfig/docker-network

Environment=GOTRACEBACK=crash

Environment=DOCKER_HTTP_HOST_COMPAT=1Environment=PATH=/usr/libexec/docker:/usr/bin:/usr/sbin

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 \--init-path=/usr/libexec/docker/docker-init-current \--seccomp-profile=/etc/docker/seccomp.json \

$OPTIONS \

$DOCKER_STORAGE_OPTIONS \

$DOCKER_NETWORK_OPTIONS \

$ADD_REGISTRY \

$BLOCK_REGISTRY \

$INSECURE_REGISTRY \

$REGISTRIES

ExecReload=/bin/kill -s HUP $MAINPID

LimitNOFILE=1048576LimitNPROC=1048576LimitCORE=infinity

TimeoutStartSec=0Restart=on-abnormal

KillMode=process

[Install]

WantedBy=multi-user.target

Docker version 19.03.12

[root@localhost ~]# docker -v

Docker version19.03.12, build 48a66213fe

[root@localhost~]# cat /usr/lib/systemd/system/docker.service

[Unit]

Description=Docker Application Container Engine

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 systemdforcgroups because the delegate issues still

# exists and systemd currently does not support the cgroup feature set required

#forcontainers run by docker

ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock

ExecReload=/bin/kill -s HUP $MAINPID

TimeoutSec=0RestartSec=2Restart=always

# Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.

# Both the old, and new location are accepted by systemd229and up, so using the old location

# tomake them work foreither version of systemd.

StartLimitBurst=3# Note that StartLimitInterval was renamed to StartLimitIntervalSecin systemd 230.

# Both the old, and new name are accepted by systemd230 and up, so using the old name to make# this option workforeither version of systemd.

StartLimitInterval=60s

# Having non-zero Limit*s causes performance problems due to accounting overhead

#in the kernel. We recommend using cgroups to do container-local accounting.

LimitNOFILE=infinity

LimitNPROC=infinity

LimitCORE=infinity

# Comment TasksMaxifyour systemd version does not support it.

# Only systemd226and above support this option.

TasksMax=infinity

# set delegate yes so that systemd does not reset the cgroups of docker containers

Delegate=yes

#kill only the docker process, not all processes inthe cgroup

KillMode=process

[Install]

WantedBy=multi-user.target

原文件如下:

[Unit]

Description=Docker Application Container Engine

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 systemdforcgroups because the delegate issues still

# exists and systemd currently does not support the cgroup feature set required

#forcontainers run by docker

ExecStart=/usr/bin/dockerd -H fd://--containerd=/run/containerd/containerd.sock

ExecReload=/bin/kill -s HUP $MAINPID

TimeoutSec=0RestartSec=2Restart=always

# Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.

# Both the old, and new location are accepted by systemd229and up, so using the old location

# tomake them work foreither version of systemd.

StartLimitBurst=3# Note that StartLimitInterval was renamed to StartLimitIntervalSecin systemd 230.

# Both the old, and new name are accepted by systemd230 and up, so using the old name to make# this option workforeither version of systemd.

StartLimitInterval=60s

# Having non-zero Limit*s causes performance problems due to accounting overhead

#in the kernel. We recommend using cgroups to do container-local accounting.

LimitNOFILE=infinity

LimitNPROC=infinity

LimitCORE=infinity

# Comment TasksMaxifyour systemd version does not support it.

# Only systemd226and above support this option.

TasksMax=infinity

# set delegate yes so that systemd does not reset the cgroups of docker containers

Delegate=yes

#kill only the docker process, not all processes inthe cgroup

KillMode=process

[Install]

WantedBy=multi-user.target

参考博客:

https://blog.csdn.net/qq_19734597/article/details/90633108

docker开放的端口_Docker 开启2375端口,提供外部访问docker相关推荐

  1. docker 开启2375端口,提供外部访问docker

    编辑docker文件:/usr/lib/systemd/system/docker.service vim /usr/lib/systemd/system/docker.service 修改ExecS ...

  2. docker 开启2375端口提供外部访问docker

    一.编辑docker文件:/usr/lib/systemd/system/docker.service 命令:vim /usr/lib/systemd/system/docker.service 修改 ...

  3. 【docker】docker 开启2375端口,提供外部访问docker

    目录 1.查看docker配置文件位置 2.打开docker服务文件 3.重新加载docker配置 1.查看docker配置文件位置 systemctl status docker

  4. docker开启2375端口

    Docker开启Remote API 访问 2375端口 - hongdada - 博客园https://www.cnblogs.com/hongdada/p/11512901.htmldocker ...

  5. Ubuntu Docker 开启2375端口 【手把手教程】

    背景: 为什么要开启2375端口? 开发环境下可以通过此端口直接向部署有Docker的那个服务器直接推送程序. 什么情况下需要如此操作? 1.操作系统安装完Docker后 2.Ubuntu 系统升级D ...

  6. 外部访问docker容器(docker run -p/-P 指令) docker run -d -p 5000:5000 {hostPort:containerPort(映射所有接口地}

    https://www.cnblogs.com/williamjie/p/9915019.html (2)-p(小写)则可以指定要映射的IP和端口,但是在一个指定端口上只可以绑定一个容器.支持的格式有 ...

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

    1.编辑docker.service # vim /usr/lib/systemd/system/docker.service 在 ExecStart=/usr/bin/dockerd-current ...

  8. docker 开启2375端口

    $: vi /etc/systemd/system/docker.service新增:ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix: ...

  9. linux怎么开放3306端口,Linux开启3306端口(开放mysql访问端口)

    1.本地测试3306是否开启 首先要ping一下看是否联通 ping 192.168.43.47 之后使用telnet命令查看是否可用 telnet 192.168.43.47 3306 2.linu ...

最新文章

  1. 为云服务立规矩——首批可信云服务认证名单公布
  2. 11g废弃的Hint - BYPASS_UJVC
  3. 为什么物联网没有杀手级应用
  4. chrome 看每行代码的运行时间
  5. 冒名者还是重名?疑惑中!
  6. Spring/Spring boot正确集成Quartz及解决@Autowired失效问题
  7. 一款超强可视化报表工具:RDP报表工具
  8. python 关于Python看金庸小说的实验
  9. js中获得月份getmonth()+1,为什么要加1?
  10. 幽默故事:1、我喜欢的女神;2、农村淑女(木子家原创)
  11. 深度 | 用于图像分割的卷积神经网络:从R-CNN到Mark R-CNN
  12. Python科研绘图——介绍
  13. (开源)带有笔顺的字体
  14. 思科路由器的密码重置
  15. 问题:vscode 中用matplotlib 绘图时无法弹窗,不显示图像
  16. Fedora安装字体方法和Ubuntu非常不同!
  17. “笨鸟”荣耀的2021
  18. 企业微信接口开发——通讯录管理(创建、删除)
  19. matlab计算abc三相短路电流_负荷开关的额定电压、额定电流,峰值耐受电流(注电案例1339)...
  20. 爬取网页数据所用到的方法-Selenium篇

热门文章

  1. 文件上传漏洞知识总结
  2. 80%的人都没看过的【软件测试】零基础到精通完整版学习路线+资料包
  3. Oculus VR设计指南
  4. Matroska文件的SSA/ASS Subtitle
  5. ORM 框架--EF详解
  6. 芜湖计算机姚明老师,2012安徽选调生申论热点:姚明的特别贡献
  7. Verilog语言之模块层级:模块的实例化
  8. 西门子comfort精智屏如何恢复出厂设置?
  9. 三甲医院检验科规划设计方案,SICOLAB分享
  10. ros工控机在foxy安装雷达 速度控制 摄像头 orb_slam3