Centos安装Docker、Docker-compose

Centos,compose,安装Docker · 浏览次数 : 328

小编点评

Docker version 20.10.18, build b40c2f6卸载dockeryum list installed | grep dockeryum remove 移除需要卸载的组件yum remove docker \\ docker-client \\ docker-client-latest \\ docker-common \\ docker-latest \\ docker-latest-logrotate \\ docker-logrotate \\ docker-selinux \\ docker-engine-selinux \\ docker-enginerm -rf /etc/systemd/system/docker.service.drm -rf /var/lib/dockerrm -rf /var/run/docker安装docker-composeyum install python-pip python3-pip python3-develpip3 install docker-compose

正文

Docker的搭建

Docker版本要求

要求 CentOs7 系统的内核版本高于 3.10,可通过如下指令查看版本

uname -r

更新yum

需先安装必要的软件包,yum-utilsdevice-mapper-persistent-datalvm2

yum-utils:提供一个yum-config-manager单元,device-mapper-persistent-datalvm2用于储存设备映射(devicemapper)必须的两个软件包

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

配置稳定的仓库

配置阿里云仓库,仓库配置会保存到/etc/yum.repos.d/docker-ce.repo文件中

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

更新Yum安装的相关Docker软件包

sudo yum makecache fast#会出错
# centos8使用这个命令,centos8无fast参数
sudo yum makecache

安装Docker

安装步骤

  1. 查看版本,可指定版本安装
    yum list docker-ce --showduplicates | sort -r
  2. 安装
    yum install -y docker-ce docker-ce-cli

出现错误:problem with installed package buildah-1.22.3-2.module_el8.5.0+911+f19012f9.x86_64

错误信息

Repository extras is listed more than once in the configuration
Last metadata expiration check: 0:08:23 ago on Tue 18 Oct 2022 13:44:28 CST.
Error: 
 Problem: problem with installed package buildah-1.22.3-2.module_el8.5.0+911+f19012f9.x86_64
  - package buildah-1.22.3-2.module_el8.5.0+911+f19012f9.x86_64 requires runc >= 1.0.0-26, but none of the providers can be installed
  - package containerd.io-1.4.3-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.4.3-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package docker-ce-3:20.10.18-3.el8.x86_64 requires containerd.io >= 1.4.1, but none of the providers can be installed
  - package containerd.io-1.4.3-3.2.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.4.3-3.2.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.4.10-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.4.10-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.4.11-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.4.11-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.4.12-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.4.12-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.4.13-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.4.13-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.4.4-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.4.4-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.4.6-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.4.6-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.4.8-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.4.8-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.4.9-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.4.9-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.5.10-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.5.10-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.5.11-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.5.11-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.6.4-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.6.4-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.6.6-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.6.6-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.6.7-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.6.7-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.6.8-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - package containerd.io-1.6.8-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
  - cannot install the best candidate for the job
  - package runc-1.0.0-56.rc5.dev.git2abd837.module_el8.3.0+569+1bada2e4.x86_64 is filtered out by modular filtering
  - package runc-1.0.0-66.rc10.module_el8.5.0+1004+c00a74f5.x86_64 is filtered out by modular filtering
  - package runc-1.0.0-72.rc92.module_el8.5.0+1006+8d0e68a2.x86_64 is filtered out by modular filtering
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

解决办法

  1. 删除podman buildah
yum erase podman buildah
  1. 查看版本,可指定版本安装
yum list containerd.io --showduplicates | sort -r
  1. 安装containerd.io
yum install -y containerd.io
  1. 再安装docker-ce docker-ce-cli
yum install -y docker-ce docker-ce-cli

启动docker

  1. 设置开机自启动
sudo systemctl start docker
sudo systemctl enable docker
  1. 启动
sudo systemctl start docker
  1. 验证
docker -v
**出现以下文字,说明安装成功**
Docker version 20.10.18, build b40c2f6

卸载docker

yum list installed | grep docker
yum remove 移除需要卸载的组件

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

rm -rf /etc/systemd/system/docker.service.d

rm -rf /var/lib/docker

rm -rf /var/run/docker

安装docker-compose

yum install python-pip python-dev
pip install docker-compose

# centos8 使用以下命令安装
yum install epel-release python3-pip python3-devel
pip3 install --upgrade pip
pip3 install docker-compose

出现以下文字,说明安装成功

docker-compose -v
docker-compose version 1.29.2, build unknown

与Centos安装Docker、Docker-compose相似的内容:

Centos安装Docker、Docker-compose

Docker的搭建 Docker版本要求 要求 CentOs7 系统的内核版本高于 3.10,可通过如下指令查看版本 uname -r 更新yum 需先安装必要的软件包,yum-utils、device-mapper-persistent-data、lvm2 yum-utils:提供一个yum-co

在CentOS8中安装gitlab

安装 docker 及 docker-compose centos8 更新源 cd /etc/yum.repos.d/ sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* sed -i 's|#baseurl=http://mi

知识图谱(Knowledge Graph)- Neo4j 5.10.0 CentOS 安装

[知识图谱(Knowledge Graph)- Neo4j 5.10.0 Docker 安装](https://www.cnblogs.com/vipsoft/p/17623086.html) [知识图谱(Knowledge Graph)- Neo4j 5.10.0 CentOS 安装](https

知识图谱(Knowledge Graph)- Neo4j 5.10.0 Docker 安装

[知识图谱(Knowledge Graph)- Neo4j 5.10.0 Docker 安装](https://www.cnblogs.com/vipsoft/p/17623086.html) [知识图谱(Knowledge Graph)- Neo4j 5.10.0 CentOS 安装](https

MQTT(EMQX) - Linux CentOS Docker 安装

Linux CentOS Docker 安装 MQTT(EMQX), el7-amd64 => EL 是 Red Hat Enterprise Linux 的简写, “el7” 表示的是 centos7/redhat7, amd64 一般指:x86-64

Docker安装

Docker安装 1、环境说明 CentOS Docker 安装 前提条件 目前,CentOS 仅发行版本中的内核支持 Docker。Docker 运行在CentOS 7 (64-bit)上,要求系统为64位、Linux系统内核版本为 3.8以上,这里使用Centos7.9 查看自己的内核 cat

[转帖]制作本地docker-ce镜像仓库(使用reposync、createrepo、httpd)

记录:330 场景:在CentOS 7.9操作系统上,使用reposync从开源镜像站下载docker-ce镜像仓库的rpm包;使用createrepo制作本地docker-ce镜像仓库;使用httpd发布服务。解决内网中使用yum命令安装docker-ce的需求。 版本: 操作系统:CentOS

Docker获取Let`s Encrypt SSL 证书

文中的操作都是在CentOS Stream release 9下执行的,使用的是root用户。 1. 安装docker # 卸载原有的docker yum remove docker docker-client docker-client-latest docker-common docker-la

[转帖]Docker Centos 支持中文字符集编码

https://www.jianshu.com/p/ac267eac47d1 我们在使用 Docker centos7.2 镜像时发现即使安装了中文字符集环境包,通过下面的命令来实现支持中文,但是在用 yum 安装某些软件后,比如执行 yum -y reinstall glibc glibc-com

[转帖]Centos下使用containerd管理容器:5分钟从docker转型到containerd

https://www.cnblogs.com/renshengdezheli/p/16684175.html 目录 一.系统环境 二.前言 三.containerd 四.部署containerd 4.1 安装containerd 4.2 containerd配置文件 4.3 配置container