0
点赞
收藏
分享

微信扫一扫

CentOS 8.1.1911安装Docker环境

新鲜小饼干 2022-03-25 阅读 89
java后端

准备工作

一台服务器

安装步骤

安装Docker依赖库

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

添加Docker CE的软件源信息

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

安装Docker CE

yum -y install docker-ce

注意:此处可能会报错

Problem: package docker-ce-3:19.03.12-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of the providers can be installed
  - cannot install the best candidate for the job
  - package containerd.io-1.2.10-3.2.el7.x86_64 is filtered out by modular filtering
  - package containerd.io-1.2.13-3.1.el7.x86_64 is filtered out by modular filtering
  - package containerd.io-1.2.13-3.2.el7.x86_64 is filtered out by modular filtering
  - package containerd.io-1.2.2-3.3.el7.x86_64 is filtered out by modular filtering
  - package containerd.io-1.2.2-3.el7.x86_64 is filtered out by modular filtering
  - package containerd.io-1.2.4-3.1.el7.x86_64 is filtered out by modular filtering
  - package containerd.io-1.2.5-3.1.el7.x86_64 is filtered out by modular filtering
  - package containerd.io-1.2.6-3.3.el7.x86_64 is filtered out by modular filtering
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

因为在centos8默认使用podman代替docker,所以需要containerd.io组件支持,安装containerd.io即可解决,执行命令

yum install https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.6-3.3.fc30.x86_64.rpm

重新执行安装docker ce命令

yum -y install docker-ce

启动Docker服务

systemctl start docker

配置阿里云镜像加速

tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://e30653kq.mirror.aliyuncs.com"]
}
EOF

此处的https://e30653kq.mirror.aliyuncs.com为我的加速镜像,这个可以自己去阿里云镜像容器服务生成自己的路径

重新加载配置

systemctl daemon-reload

重启Docker

systemctl restart docker

结束语

确定自己linux内核版本可使用命令

lsb_release -a

我这边显示的结果是

LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	CentOS
Description:	CentOS Linux release 8.1.1911 (Core) 
Release:	8.1.1911
Codename:	Core
举报

相关推荐

0 条评论