CentOS8安装docker

1、安装yum-utils

1sudo yum install -y yum-utils device-mapper-persistent-data lvm2

如果安装出错了,报错:

1Error: Failed to download metadata ``for repo ``'appstream'``: Cannot prepare ``internal mirrorlist: No URLs ``in mirrorlist

安装一下环境

123456789101112131、进入到 yum 的 repos 目录``cd /etc/yum.repos.d/ 2、修改 centos 文件内容``sed -i ``'s/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*``sed -i ``'s\|#baseurl=http://mirror.centos.org\|baseurl=http://vault.centos.org\|g' /etc/yum.repos.d/CentOS-* 3、生成缓存更新``yum makecache 4、运行 yum update 并重新安装 vim``yum update -y``yum -y install vim

  

2、为yum源添加docker仓库位置

1sudo yum-config-manager --add-repo https:``//download.docker.com/linux/centos/docker-ce.repo

3、安装docker

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

此时可能又会报错:

12Problem 1: problem with installed package podman-3.3.1-9.module_el8.5.0+988+b1f0b741.x86_64``Problem 2: problem with installed package buildah-1.22.3-2.module_el8.5.0+911+f19012f9.x86_64

执行:

1sudo yum erase podman buildah

4、然后重新执行安装命令

5、启动docker

1systemctl start docker

安装完成

6、添加自启动

12345// docker开机启动``systemctl enable docker.service // 容器自启动``docker update --restart=always 容器名称

原文链接:https://www.cnblogs.com/minihu/p/17955020


标题:CentOS8安装docker
作者:Curry
地址:http://bolo.it-cxy.top/articles/2024/10/25/1729826936248.html

    评论
    0 评论
avatar

取消