amazon-web-servicesdockeramazon-ec2amazon-linuxamazon-ecr

How to install docker on Amazon Linux2


I wanna create docker image for Amazon ECR. but yum can't find it in my Amazon Linux2.

[root@*** ~]# yum install -y docker
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
No package docker available.
Error: Nothing to do

Next, I tried to use amazon-linux-extras.

but amazon-linux-extras is not found, too.

[root@*** ~]# amazon-linux-extras install docker -y
-bash: amazon-linux-extras: command not found
[root@*** ~]# find / -name 'amazon-linux-extras'
[root@*** ~]$ cat /proc/version
Linux version 4.14.77-81.59.amzn2.x86_64 (mockbuild@ip-10-0-1-59) (gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC)) #1 SMP Mon Nov 12 21:32:48 UTC 2018

How can I install amazon-linux-extras or create docker image?


Solution

  • So sorry, it was my misunderstanding. My OS is Redhat Linux. I get to install docker by

    yum-config-manager --enable rhui-REGION-rhel-server-extras
    yum -y install docker 
    systemctl start docker
    systemctl enable docker
    docker version