赞
踩
以官方文档和最新的版本为例
docker官网:https://docs.docker.com/engine/install/centos/
官方文档:
OS requirements
To install Docker Engine, you need a maintained version of CentOS 7 or 8. Archived versions aren’t supported or tested.
The centos-extras repository must be enabled. This repository is enabled by default, but if you have disabled it, you need to re-enable it.
要安装 Docker Engine,你需要一个 CentOS 7或8的维护版本。
必须启用 centos-extras 存储库。此存储库默认是启用的,但是如果您已经禁用了它,则需要重新启用它。
[root@localhost bin]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
Older versions of Docker were called docker or docker-engine. If these are installed, uninstall them, along with associated dependencies.
旧版本的 Docker 被称为 Docker 或 Docker-engine。如果已经安装了它们,请卸载它们以及相关的依赖项。
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
yum -y install gcc-c++
官方文档:
Most users set up Docker’s repositories and install from them, for ease of installation and upgrade tasks. This is the recommended approach.
大多数用户建立了 Docker 的存储库并从中安装,以便于安装和升级任务。这是推荐的方法。
Install the yum-utils package (which provides the yum-config-manager utility) and set up the stable repository.
安装 yum-utils 包(它提供 yum-config-manager 实用工具)并设置稳定存储库。
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
Install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:
安装最新版本的 Docker Engine 和 containerd,或者进入下一步安装一个特定版本:
yum install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
Verify that Docker Engine is installed correctly by running the hello-world image.
通过运行 hello-world 映像来验证 Docker Engine 安装是否正确。
sudo docker run hello-world
This command downloads a test image and runs it in a container. When the container runs, it prints a message and exits.
此命令下载测试映像并在容器中运行它。当容器运行时,它打印一条消息并退出。
This installs and runs Docker Engine. Use sudo to run Docker commands. Continue to Linux postinstall to allow non-privileged users to run Docker commands and for other optional configuration steps.
这将安装并运行 Docker 引擎。使用 sudo 运行 Docker 命令。继续安装 Linux 后,允许非特权用户运行 Docker 命令和其他可选配置步骤。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。