首页 > 系统相关 >Centos安装Docker、Docker-compose

Centos安装Docker、Docker-compose

时间:2022-12-22 17:12:39浏览次数:46  
标签:compose x86 Centos package el8.5 module runc 64 Docker

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

标签:compose,x86,Centos,package,el8.5,module,runc,64,Docker
From: https://www.cnblogs.com/reim/p/16999157.html

相关文章

  • SpringBoot项目Jar包构建Docker镜像
    在jar包同级目录创建Dockerfile文件,写入一下:FROMopenjdk:11MAINTAINERdemoADD[jar包文件][生成的镜像名称]EXPOSE8110//镜像暴露的端口号ENTRYPOINT["java",......
  • Docker容器配置Nacos、Sentinel
    nacosdockerrun-d-p8848:8848--namenacos--restart=always--envMODE=standalone--envSPRING_DATASOURCE_PLATFORM=mysql--envMYSQL_SERVICE_HOST=140.2......
  • centos安装python3
    1:使用CentOS自带的包管理器yum安装新版本的Python。例如,你可以使用以下命令安装最新的Python3版本:sudoyumupdatesudoyuminstallpython32:使用SCL库安......
  • centos安装k8s
    1、确保每台机器上有dockerhttp://get.daocloud.io/#install-docker2、关闭每台机器上的swap,selinuxswapoff-asetenforce0sed-i's/^SELINUX=enforcing$/SELINU......
  • centos安装k8s注意点
    安装方法,参考https://blog.csdn.net/frankgy01/article/details/127936367 https://www.cnblogs.com/yangzp/p/16932270.htmlhttps://blog.csdn.net/qq_40279964/artic......
  • docker安装ELK
    一、elasticsearch(仅用于测试环境)1、拉取镜像(docker版本19.03.9)dockerpullelastic/elasticsearch:7.10.22、创建挂载目录mkdir-p/data/elk/es/{config,data,log......
  • Docker学习笔记十四:Docker安装Grafana
    介绍是一个开源的度量分析和可视化工具,可以通过将采集的数据分析、查询,然后进行可视化的展示,并能实现报警。参考官网地址:https://grafana.com/docs/grafana/latest/inst......
  • Linux部署docker镜像之PHP项目的Dockerfile步骤
    二、Docker部署步骤1、项目编译成镜像请cd到和Dockerfile同目录;例如:cd/home/docker dockerbuild-twebsite:latest.2、查看镜像并创建容器 dockerimages ......
  • CenterOS7安装docker
    CenterOS7安装docker官方文档卸载旧版本sudoyumremovedocker\docker-client\docker-client-latest\......
  • 阿里云镜像加速(docker)
    阿里云镜像加速docker登录阿里云平台阿里云-为了无法计算的价值(aliyun.com)将命令复制到控制台执行......