CentOS8安装docker
1、安装yum-utils
1 | sudo yum install -y yum-utils device-mapper-persistent-data lvm2 |
---|
如果安装出错了,报错:
1 | Error: Failed to download metadata ``for repo ``'appstream'``: Cannot prepare ``internal mirrorlist: No URLs ``in mirrorlist |
---|
安装一下环境
12345678910111213 | 1、进入到 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仓库位置
1 | sudo yum-config-manager --add-repo https:``//download.docker.com/linux/centos/docker-ce.repo |
---|
3、安装docker
1 | yum install -y docker-ce docker-ce-cli containerd.io |
---|
此时可能又会报错:
12 | Problem 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 |
---|
执行:
1 | sudo yum erase podman buildah |
---|
4、然后重新执行安装命令
5、启动docker
1 | systemctl start docker |
---|
安装完成
6、添加自启动
12345 | // docker开机启动``systemctl enable docker.service // 容器自启动``docker update --restart=always 容器名称 |
---|
评论
0 评论