CenterOS7安装docker

CenterOS7安装docker

官方文档

  • 卸载旧版本

    image-20221221140853799

    sudo yum remove docker \
                      docker-client \
                      docker-client-latest \
                      docker-common \
                      docker-latest \
                      docker-latest-logrotate \
                      docker-logrotate \
                      docker-engine
    
  • yum安装gcc相关依赖

    yum -y install gcc
    yum -y install gcc-c++
    
  • 设置存储库

    image-20221221141332973

    sudo yum install -y yum-utils
    #镜像仓库换成阿里云
    sudo yum-config-manager \
        --add-repo \
        http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    
  • 安装docker ce

    yum -y install docker-ce docker-ce-cli containerd.io
    
  • 启动docker

    systemctl start docker
    
  • 测试

    docker version
    
    docker run hello-world
    
  • 卸载docker

    systemctl stop docker
    yum remove docker-ce docker-ce-cli containerd.io
    rm -rf /var/lib/docker
    rm -rf /var/lib/containerd
    
posted @ 2022-12-22 14:10  striver-sc  阅读(117)  评论(0编辑  收藏  举报