在 CentOS 6.6 上安装 Docker [英] Installing Docker on CentOS 6.6
问题描述
我正在尝试在 CentOS 6.6 64 位版本上安装 Docker.执行时
I'm trying to install Docker on CentOS 6.6 64 bit version. When execute
sudo yum install docker
我明白了
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.psychz.net
* extras: centos-distro.cavecreek.net
* updates: distro.ibiblio.org
No package docker available.
Error: Nothing to do
推荐答案
[澄清]:
根据 官方 docker 文档,关于 Centos 操作系统的要求:
Regarding Centos OS requirements as per the official docker docs:
要安装 Docker 引擎 - 社区,你需要一个 CentOS 7
的维护版本.存档版本不受支持或测试.(所以我假设现在不再支持 Centos 6
.)
To install Docker Engine - Community,
you need a maintained version of CentOS 7
.
Archived versions aren’t supported or tested. (So I assume Centos 6
is now no longer supported.)
以下配方适用于 Centos 7 和 8
The following recipes are for Centos 7 and 8
Centos 7:
# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
- 第 1 步:安装所需的软件包.
- Step 1: Install required packages.
$ sudo yum -y update
$ sudo yum install -y yum-utils
device-mapper-persistent-data
lvm2
- 第 2 步:使用以下命令设置稳定存储库.
- Step 2: Use the following command to set up the stable repository.
$ sudo yum-config-manager
--add-repo
https://download.docker.com/linux/centos/docker-ce.repo
- 第 3 步:安装最新版本的 Docker CE 和 containerd
- Step 3: Install the latest version of Docker CE and containerd
$ sudo yum install docker-ce docker-ce-cli containerd.io
如果您在此步骤中遇到错误,Package: docker-ce-xxx.centos.x86_64 (docker-ce-stable) Requires: container-selinux >= 2.9
In case you have an error for this step, Package: docker-ce-xxx.centos.x86_64 (docker-ce-stable) Requires: container-selinux >= 2.9
你可以这样做:
$ sudo yum install -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.74-1.el7.noarch.rpm
查看问题 Docker CE on RHEL - 需要:容器-selinux >= 2.9
- 第 4 步:启动 Docker.
- Step 4: Start Docker.
$ sudo systemctl start docker
- 第 5 步:通过运行 hello-world 映像验证 Docker CE 是否已正确安装.
- Step 5: Verify that Docker CE is installed correctly by running the hello-world image.
$ sudo docker run hello-world
如果您想以非 root 用户身份使用 Docker,您现在应该考虑将您的用户添加到docker"组,例如:
If you would like to use Docker as a non-root user, you should now consider adding your user to the "docker" group with something like:
$ sudo usermod -aG docker $USER
$ docker run hello-world
应该是这样的.
如果您也想安装 docker-compose,可以关注 其官方文档一个>.
In case you would like to install docker-compose too, you can follow its official docs.
Centos 8:
$ cat /etc/centos-release
CentOS Linux release 8.0.1905 (Core)
$ sudo yum -y update
$ sudo yum install docker
$ sudo docker run hello-world
就是这样.
这篇关于在 CentOS 6.6 上安装 Docker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!