docker—centos上的安装配置
本文章参考,官网Install Docker Engine on CentOS
1.Docker对于centos的系统要求
To install Docker Engine, you need a maintained version of one of the following CentOS versions:
(要安装Docker Engine,您需要以下CentOS版本之一的维护版本:)
- CentOS 7
- CentOS 8 (stream)
- CentOS 9 (stream)
2.Docker卸载
Older versions of Docker went by the names of docker or docker-engine. Uninstall any such older versions before attempting to install a new version, along with associated dependencies:
(旧版本的Docker被称为Docker或Docker引擎。在尝试安装新版本之前,卸载任何此类旧版本以及相关的依赖项)
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
3.Docker安装
- docker依赖安装
yum -y install gcc
yum -y install gcc-c++
yum install -y yum-utils
- docker镜像仓库配置
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
注意:以下为官网配置,但国内网络限制,不可使用
yum-config-manager
–add-repo
https://download.docker.com/linux/centos/docker-ce.repo
- 更新yum软件包索引
yum makecache fast
- docker安装
yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- docker的启动与查看
启动:systemctl start docker
检查:systemctl start docker