• 容器管理工具Docker生态架构及部署


    目录

    一.Docker生态架构

    1.docker容器运行场景

    2.生态架构

     Docker Host

    Docker daemon

    Registry

    Docker client

    Image

    Container

    Docker Dashboard

     3.docker版本

    二.docker部署

    1.通过yum源安装docker

    2.安装docker-ce

    3.配置docker daemon启动文件

    修改后的配置文件内容(直接复制黏贴即可)

    4.启动docker服务并查看已安装版本

    5.如何卸载docker

    二进制部署docker


    一.Docker生态架构

    1.docker容器运行场景

    在刚发布的时候,只能在linux系统,但现在可以在Windows,数据中心,云等

    运用场景广泛

    2.生态架构

     Docker Host

    用于安装Docker daemon的主机,即为Docker Host,并且该主机可基于容器镜像运行容器

    Docker daemon

    用于管理Docker Host中的容器,容器镜像,容器网络等,管理由Containerd.io提供的容器

    Registry

    容器镜像仓库,用于存储已生成容器运行模板的仓库,用户使用时,可直接从容器镜像仓库中下载容器镜像,即容器运行模板,就可以运行容器中包含的内容了。例如Docker hub(官方镜像) , 也可以使用Harbor实现企业私有的容器镜像仓库。

    Docker client

    Docker Daemon客户端管理工具,用于同Docker Daemon进行通信,执行用户指令,可部署在Docker Host上,也可以部署在其他主机,能够连接到Docker Daemon即可操作

    Image

    把应用运行环境及计算资源打包方式生成可再用于启动容器的不可变的基础设施的模板文件,主要用于基于其启动环境

    Container

    由容器镜像生成,用于应用程序运行的环境,包含容器镜像中所有文件及用户后添加的文件,属于基于容器镜像生成的可读写层,这也是应用程序活跃的空间

    Docker Dashboard

    Docker Dashboard 提供了一个简单的界面,使您的机器管理您的容器,应用程序和镜像,而无需命令行。简单点说,就是个可视化软件。

     3.docker版本

    Docker-ce 社区版,个人免费

    Docker-ee 企业版,可以免费一个月。

    二.docker部署

    docker-ce镜像_docker-ce下载地址_docker-ce安装教程-阿里巴巴开源镜像站 (aliyun.com)

    按照连接中的步骤即可 

    1.通过yum源安装docker

    wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    

    2.安装docker-ce

    yum -y install docker-ce

    3.配置docker daemon启动文件

    为了防止docker和本地防火墙起冲突,需要修改下配置文件

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

    修改的内容如下

    需要修改的句子大概在13行 

    1. ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
    2. 修改为
    3. ExecStart=/usr/bin/dockerd
    4. 并额外添加一条
    5. ExecStartPost=/sbin/iptables -P FORWARD ACCEPT(这一条是为了解决防火墙冲突)

    修改后的配置文件内容(直接复制黏贴即可)

    1. [Unit]
    2. Description=Docker Application Container Engine
    3. Documentation=https://docs.docker.com
    4. After=network-online.target docker.socket firewalld.service containerd.service
    5. Wants=network-online.target
    6. Requires=docker.socket containerd.service
    7. [Service]
    8. Type=notify
    9. # the default is not to use systemd for cgroups because the delegate issues still
    10. # exists and systemd currently does not support the cgroup feature set required
    11. # for containers run by docke
    12. ExecStart=/usr/bin/dockerd
    13. ExecStartPost=/sbin/iptables -P FORWARD ACCEPT
    14. ExecReload=/bin/kil ts HUP $MAINPID
    15. TimeoutSec=0
    16. RestartSec=2
    17. Restart=always
    18. # Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
    19. # Both the old, and new location are accepted by systemd 229 and up, so using the old location
    20. # to make them work for either version of systemd.
    21. StartLimitBurst=3
    22. # Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.
    23. # Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
    24. # this option work for either version of systemd.
    25. StartLimitInterval=60s
    26. # Having non-zero Limit*s causes performance problems due to accounting overhead
    27. # in the kernel. We recommend using cgroups to do container-local accounting.
    28. LimitNOFILE=infinity
    29. LimitNPROC=infinity
    30. LimitCORE=infinity
    31. # Comment TasksMax if your systemd version does not support it.
    32. # Only systemd 226 and above support this option.
    33. TasksMax=infinity
    34. # set delegate yes so that systemd does not reset the cgroups of docker containers
    35. Delegate=yes
    36. # kill only the docker process, not all processes in the cgroup
    37. KillMode=process
    38. OOMScoreAdjust=-500
    39. [Install]
    40. WantedBy=multi-user.target

    4.启动docker服务并查看已安装版本

    1. systemctl daemon-reload
    2. systemctl start docker
    3. systemctl enable docker
    4. systemctl status docker
    5. docker version

    5.如何卸载docker

    原文连接:CentOS完整卸载Docker_运维@小兵的博客-CSDN博客_centos 卸载docker

    先查看有哪些包

    yum list installed | grep docker

    yum -y remove 后面跟图片中的具体的安装包名称 

    1. systemctl stop docker
    2. yum -y remove docker.x86_64
    3. yum -y remove docker-client.x86_64
    4. yum -y remove docker-common.x86_64
    5. rm -rf /etc/docker
    6. rm -rf /run/docker
    7. rm -rf /var/run/docker
    8. rm -rf /var/lib/dockershim
    9. rm -rf /var/lib/docker

    或者用下面这种方法卸载

    1. systemctl stop docker
    2. yum remove docker-ce containerd.io docker-ce-cli

    检查是否卸载:

    docker version

    如果提示没有docker命令则卸载成功

    二进制部署docker

    参考官方连接:

    Install Docker Engine from binaries | Docker Documentation

    Docker Documentation | Docker Documentation

     

     

  • 相关阅读:
    Jenkins插件Parameterized Scheduler用法
    【Python机器学习】零基础掌握GaussianProcessRegressor高斯过程
    工业自动化工厂PLC远程控制网关物联网应用
    SpringCloud学习笔记-gateway网关自定义全局过滤器
    main.js 中的 render函数
    2023-09-06力扣每日一题-摆烂暴力
    使用VuePress快速搭建博客
    【常见开发问题】阿里云无法登录的问题
    WebSocket实战之四WSS配置
    d为何用模板参数
  • 原文地址:https://blog.csdn.net/qq_44418229/article/details/126920768