Docker安装

Posted rtoax

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Docker安装相关的知识,希望对你有一定的参考价值。

Docker安装

荣涛
2021年10月29日

文档修改日志

日期修改内容修改人备注
2021年10月29日创建荣涛

1. 引言

2. yum安装

# 安装docker所需的工具
yum install -y yum-utils device-mapper-persistent-data lvm2
# 配置阿里云的docker源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# 搜索源上docker-ce版本
$ yum search docker --showduplicates
# 安装docker-ce
yum install -y docker-ce-xxxx
# 启动docker
systemctl enable docker && systemctl start docker

安装中可能遇到问题:

$ sudo yum install docker-ce docker-ce-cli containerd.io
CentOS Linux 8 - AppStream                      669 kB/s | 6.2 MB     00:09    
CentOS Linux 8 - BaseOS                         351 kB/s | 2.3 MB     00:06    
Docker CE Stable - x86_64                       1.1 kB/s | 7.1 kB     00:06    
Docker CE Nightly - x86_64                      327  B/s | 2.6 kB     00:08    
Error:
 Problem 1: problem with installed package podman-2.0.5-5.module_el8.3.0+512+b3b58dca.x86_64
  - package podman-2.0.5-5.module_el8.3.0+512+b3b58dca.x86_64 requires runc >= 1.0.0-57, 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.0-68.rc92.module_el8.3.0+475+c50ce30b.x86_64
  - package containerd.io-1.4.3-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.0-68.rc92.module_el8.3.0+475+c50ce30b.x86_64
  - cannot install the best candidate for the job
  - package runc-1.0.0-64.rc10.module_el8.3.0+479+69e2ae26.x86_64 is filtered out by modular filtering
 Problem 2: problem with installed package buildah-1.15.1-2.module_el8.3.0+475+c50ce30b.x86_64
  - package buildah-1.15.1-2.module_el8.3.0+475+c50ce30b.x86_64 requires runc >= 1.0.0-26, but none of the providers can be installed
  - package docker-ce-3:20.10.1-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.1.el8.x86_64 conflicts with runc provided by runc-1.0.0-68.rc92.module_el8.3.0+475+c50ce30b.x86_64
  - package containerd.io-1.4.3-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.0-68.rc92.module_el8.3.0+475+c50ce30b.x86_64
  - package containerd.io-1.4.1-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.0-68.rc92.module_el8.3.0+475+c50ce30b.x86_64
  - package containerd.io-1.4.1-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.0-68.rc92.module_el8.3.0+475+c50ce30b.x86_64
  - package containerd.io-1.4.3-3.el8.x86_64 conflicts with runc provided by runc-1.0.0-68.rc92.module_el8.3.0+475+c50ce30b.x86_64
  - package containerd.io-1.4.3-3.el8.x86_64 obsoletes runc provided by runc-1.0.0-68.rc92.module_el8.3.0+475+c50ce30b.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-64.rc10.module_el8.3.0+479+69e2ae26.x86_64 is filtered out by modular filtering

提醒冲突,执行下面命令进行卸载:

$ yum erase podman buildah

再进行安装:

$ sudo yum install docker-ce docker-ce-cli containerd.io
$ sudo systemctl start docker

如果想卸载:

# 删除安装包:
$ sudo yum remove docker-ce
# 删除镜像、容器、配置文件等内容:
$ sudo rm -rf /var/lib/docker

3. 参考链接

4. 附录


Copyright (C) CESTC Com.

以上是关于Docker安装的主要内容,如果未能解决你的问题,请参考以下文章

markdown docker-compose片段

sh Docker片段

Docker初级——介绍安装和使用

Docker和pip安装:避免在已安装某些软件包时安装所有软件包

在Tomcat的安装目录下conf目录下的server.xml文件中增加一个xml代码片段,该代码片段中每个属性的含义与用途

PHP代码-psysh调试代码片段工具