美文网首页
centos7.9安装docker

centos7.9安装docker

作者: sunpy | 来源:发表于2022-07-22 17:43 被阅读0次

    官网


    https://docs.docker.com/engine/install/centos/

    查看系统环境

    [root@ecs-140051 ~]# uname -r
    3.10.0-1160.53.1.el7.x86_64
    [root@ecs-140051 ~]# cat /etc/os-release 
    NAME="CentOS Linux"
    VERSION="7 (Core)"
    ID="centos"
    ID_LIKE="rhel fedora"
    VERSION_ID="7"
    PRETTY_NAME="CentOS Linux 7 (Core)"
    ANSI_COLOR="0;31"
    CPE_NAME="cpe:/o:centos:centos:7"
    HOME_URL="https://www.centos.org/"
    BUG_REPORT_URL="https://bugs.centos.org/"
    
    CENTOS_MANTISBT_PROJECT="CentOS-7"
    CENTOS_MANTISBT_PROJECT_VERSION="7"
    REDHAT_SUPPORT_PRODUCT="centos"
    REDHAT_SUPPORT_PRODUCT_VERSION="7"
    

    安装gcc环境

    yum -y install gcc
    yum -y install gcc-c++
    

    卸载docker旧版

    yum remove docker \
    docker-client \
    docker-client-latest \
    docker-common \
    docker-latest \
    docker-latest-logrotate \
    docker-logrotate \
    docker-engine
    

    安装需要的软件包

    yum install -y yum-utils
    

    设置镜像仓库

    # 使用阿里云镜像库
    yum-config-manager --add-repo http://mirrors.aliyun.com/dockerce/linux/centos/docker-ce.repo
    

    更新yum软件包索引

    yum makecache fast
    

    安装 Docker CE

    yum install docker-ce docker-ce-cli containerd.io
    

    启动 Docker

    systemctl start docker
    

    查看docker运行状态

    [root@ecs-140051 ~]# systemctl status docker
    

    测试

    docker version
    
    docker run hello-world
    

    卸载

    systemctl stop docker
    yum -y remove docker-ce docker-ce-cli containerd.io
    rm -rf /var/lib/docker
    

    相关文章

      网友评论

          本文标题:centos7.9安装docker

          本文链接:https://www.haomeiwen.com/subject/guamirtx.html