码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • docker 开启 tcp 端口


    默认安装的Docker服务是不支持远程连接的,开启TCP端口后可以进行远程连接Docker

    1、操作系统环境

    [root@localhost home]# uname -r
    3.10.0-1160.66.1.el7.x86_64

    2、编辑 docker 服务

    注释原有 ExecStart 参数,新增 ExecStart 参数,见加红色字体。

    [root@localhost home]# vi /lib/systemd/system/docker.service
    [Unit]
    Description=Docker Application Container Engine
    Documentation=https://docs.docker.com
    After=network-online.target firewalld.service
    Wants=network-online.target

    [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
    ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375

    ExecReload=/bin/kill -s HUP $MAINPID
    # 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
    # Uncomment TasksMax if your systemd version supports it.
    # Only systemd 226 and above support this version.
    #TasksMax=infinity
    TimeoutStartSec=0
    # set delegate yes so that systemd does not reset the cgroups of docker containers
    Delegate=yes
    # kill only the docker process, not all processes in the cgroup
    KillMode=process
    # restart the docker process if it exits prematurely
    Restart=on-failure
    StartLimitBurst=3
    StartLimitInterval=60s

    [Install]
    WantedBy=multi-user.target

    -H代表指定docker的监听方式,这里是socket文件位置,也就是socket方式,2375就是tcp端口

    3、保存退出

    4、重新加载系统服务配置文件

    systemctl daemon-reload

    5、重启 docker 服务

    systemctl restart docker

    6、查看监听端口

    ss -tnl | grep 2375

    7、查看防火墙是否开放2375端口

    [root@localhost home]# firewall-cmd --zone=public --query-port=2375/tcp

    no

    8、防火墙开启2375端口

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

    success

    9、重启防火墙

    [root@localhost home]# firewall-cmd --reload

    success

    10、idea docker 端口测试

  • 相关阅读:
    使用 Alacritty 替代 Gnome-Terminal 解决 Ubuntu 中终端的行间距问题
    2018年亚太杯APMCM数学建模大赛A题老年人平衡能力的实时训练模型求解全过程文档及程序
    pandas提取键值对(json和非json格式)
    大学生社交网络问卷调查,社交情况问卷调查报告
    React组件进阶
    LLMs之RAG:利用langchain实现RAG应用五大思路步骤—基于langchain使用LLMs(ChatGPT)构建一个问题回答文档的应用程序实战代码
    【用unity实现100个游戏之11】复刻经典消消乐游戏
    log4cpp初入门
    Red Teaming Exercises
    数据可视化----网页显示温湿度
  • 原文地址:https://blog.csdn.net/magic_kid_2010/article/details/125405536
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号