无法在Amazon Linux实例上安装Docker

时间:2019-11-29 09:19:36

标签: linux amazon-web-services docker

我的实例在此AMI上:amzn2-ami-hvm-2.0.20191116.0-x86_64-gp2 (ami-01f14919ba412de34) 我想在document之后安装docker,所以这是我的命令的输出:

[ec2-user@ip-10-193-192-42 ~]$ sudo amazon-linux-extras install docker
Installing docker
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Cleaning repos: amzn2-core amzn2extra-docker docker-ce-stable
12 metadata files removed
6 sqlite files removed
0 metadata files removed
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core                                               | 2.4 kB     00:00
amzn2extra-docker                                        | 1.3 kB     00:00
docker-ce-stable                                         | 3.5 kB     00:00
(1/6): amzn2-core/2/x86_64/group_gz                        | 2.6 kB   00:00
(2/6): amzn2-core/2/x86_64/updateinfo                      | 174 kB   00:00
(3/6): docker-ce-stable/x86_64/updateinfo                  |   55 B   00:00
(4/6): docker-ce-stable/x86_64/primary_db                  |  37 kB   00:00
(5/6): amzn2extra-docker/2/x86_64/primary_db               |  59 kB   00:00
(6/6): amzn2-core/2/x86_64/primary_db                      |  36 MB   00:00
Resolving Dependencies
--> Running transaction check
---> Package docker.x86_64 0:18.09.9ce-2.amzn2 will be installed
--> Processing Dependency: runc = 1.0.0 for package: docker-18.09.9ce-2.amzn2.x8                                                                                        6_64
--> Processing Dependency: containerd = 1.2.6 for package: docker-18.09.9ce-2.am                                                                                        zn2.x86_64
--> Processing Dependency: pigz for package: docker-18.09.9ce-2.amzn2.x86_64
--> Processing Dependency: libcgroup for package: docker-18.09.9ce-2.amzn2.x86_6                                                                                        4
--> Running transaction check
---> Package containerd.io.x86_64 0:1.2.10-3.2.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.74 for package: containerd.i                                                                                        o-1.2.10-3.2.el7.x86_64
---> Package libcgroup.x86_64 0:0.41-21.amzn2 will be installed
---> Package pigz.x86_64 0:2.3.4-1.amzn2.0.1 will be installed
--> Finished Dependency Resolution
Error: Package: containerd.io-1.2.10-3.2.el7.x86_64 (docker-ce-stable)
           Requires: container-selinux >= 2:2.74
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
Installation failed. Check that you have permissions to install.
[ec2-user@ip-10-193-192-42 ~]$

如何获得这项工作?

编辑

我的实例在Autoscaling GRoup中,因此我终止了上一个实例,并尝试在新实例中进行docker安装:

我必须安装docker,但是当我运行命令时:

sudo service docker start

我从实例注销,但出现了一个错误窗口:

network error: software caused connection abort

任何线索为什么会这样?

2 个答案:

答案 0 :(得分:1)

只是尝试将Docker安装到完全相同的AMI,并且一切顺利。我想您遇到了问题,因为存在名为docker-ce-stable的额外存储库。在Amazon Linux 2 AMI上不需要它,因此,一旦获得对新实例的SSH访问权限,请执行:

sudo amazon-linux-extras install docker

你应该没事。

答案 1 :(得分:1)

遇到了同样的问题,但是用不同的方式解决了。

在您的Amazon Linux 2框中检查是否有文件名

/etc/yum.repos.d/docker-ce

您应该将其删除。然后运行安装命令就可以了

sudo amazon-linux-extras install docker