1.官网

Install Docker Engine on CentOS | Docker Documentation

Dockerfile完全指南文档: 基础镜像的选择 (FROM) — Docker Tips 0.1 documentation

2.版本说明

Docker Engine release notes | Docker Documentation

目前最新的是20.10

3.安装的方法

官网上介绍,是有三种模式:

1.Most users set up Docker’s repositories and install from them, for ease of installation and upgrade tasks. This is the recommended approach.

2.Some users download the RPM package and install it manually and manage upgrades completely manually. This is useful in situations such as installing Docker on air-gapped systems with no access to the internet.

3.In testing and development environments, some users choose to use automated convenience scripts to install Docker.

为了方便升级,我们选择第一种方式。

4.使用存储库的方式进行安装

目前我的环境是centos 7.5的环境。

4.1.设置仓库

sudo yum install -y yum-utils
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

安装的时候,会报错,报错信息如下:

 我们改用阿里云的镜像:

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

 

4.2.安装Docker Engine

Install the latest version of Docker Engine, containerd, and Docker Compose。

sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin

​​​​​​​

如何要安装特定的版本,可以参考官网的文档。

This command installs Docker, but it doesn’t start Docker. It also creates a docker group, however, it doesn’t add any users to the group by default.

4.3.启动Docker

sudo systemctl start docker

sudo systemctl stop docker

sudo systemctl status docker

sudo systemctl restart docker

4.4.测试安装是否成功

sudo docker run hello-world

5.官网命令文档

docker version | Docker Documentation

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐