Kubernetes/Docker/Docs/Centos安装Docker.md
offends 7a2f41e7d6
All checks were successful
continuous-integration/drone Build is passing
synchronization
2024-08-07 18:54:39 +08:00

1.6 KiB

本文作者:丁辉

Docker网络安装

整体来说各系统安装方式都相差不大,那么咱们这里只举例 Centos 安装 Docker 形式

官网安装文档

开始部署

  1. 卸载就办 Docker

    sudo yum remove docker \
        docker-client \
        docker-client-latest \
        docker-common \
        docker-latest \
        docker-latest-logrotate \
        docker-logrotate \
        docker-engine
    
  2. 设置存储库

    yum install -y yum-utils
    
    yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
    

    国内源

    yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    
  3. 安装最新版

    yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
    

    安装特定版本

    • 查看版本库

      yum list docker-ce --showduplicates | sort -r
      
    • 安装

      sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io docker-buildx-plugin docker-compose-plugin
      
  4. 启动

    systemctl enable docker
    systemctl start docker
    

卸载 Docker

  1. 卸载软件包

    yum remove docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
    
  2. 清理文件

    rm -rf /var/lib/docker
    rm -rf /var/lib/containerd