Install Docker to Amazon Linux2
Page content
Migration of Amazon Linux to Amazon Linux 2 causes yum install docker
command doesn’t work in Amazon Linux 2, so I investigate how to install docker.
Motivation
Install Docker to Amazon Linux2 without error
My Packer build job stopped with error after AWS announced Amazon Linux 2 LTS Candidate in June 2018, because I migrated my server os Amazon Linux to Amazon Linux2.
Fail to execute yum install docker
and yum search docker
command because yum repository has been changed.
Install Docker with Extras Library
In Amazon Linux2, Extras Library is adopted to install some libraries.
Now list the libraries that can be installed.
1amazon-linux-extras list
2
3 0 ansible2 available [ =2.4.2 ]
4 1 emacs available [ =25.3 ]
5 2 memcached1.5 available [ =1.5.1 ]
6 3 nginx1.12 available [ =1.12.2 ]
7 4 postgresql9.6 available [ =9.6.6 =9.6.8 ]
8 5 python3 available [ =3.6.2 ]
9 6 redis4.0 available [ =4.0.5 ]
10 7 R3.4 available [ =3.4.3 ]
11 8 rust1 available [ =1.22.1 =1.26.0 ]
12 9 vim available [ =8.0 ]
13 10 golang1.9 available [ =1.9.2 ]
14 11 ruby2.4 available [ =2.4.2 =2.4.4 ]
15 12 nano available [ =2.9.1 ]
16 13 php7.2 available [ =7.2.0 =7.2.4 =7.2.5 ]
17 14 lamp-mariadb10.2-php7.2 available \
18 [ =10.2.10_7.2.0 =10.2.10_7.2.4 =10.2.10_7.2.5 ]
19 15 libreoffice available [ =5.0.6.2_15 ]
20 16 gimp available [ =2.8.22 ]
21 17 docker available [ =17.12.1 =18.03.1 ]
22 18 mate-desktop1.x available [ =1.19.0 =1.20.0 ]
23 19 GraphicsMagick1.3 available [ =1.3.29 ]
24 20 tomcat8.5 available [ =8.5.31 ]
Docker exists in it.
Install Docker with amazon-linux-extras
command.
1amazon-linux-extras install docker
2
3...
4
5 0 ansible2 available [ =2.4.2 ]
6 1 emacs available [ =25.3 ]
7 2 memcached1.5 available [ =1.5.1 ]
8 3 nginx1.12 available [ =1.12.2 ]
9 4 postgresql9.6 available [ =9.6.6 =9.6.8 ]
10 5 python3 available [ =3.6.2 ]
11 6 redis4.0 available [ =4.0.5 ]
12 7 R3.4 available [ =3.4.3 ]
13 8 rust1 available [ =1.22.1 =1.26.0 ]
14 9 vim available [ =8.0 ]
15 10 golang1.9 available [ =1.9.2 ]
16 11 ruby2.4 available [ =2.4.2 =2.4.4 ]
17 12 nano available [ =2.9.1 ]
18 13 php7.2 available [ =7.2.0 =7.2.4 =7.2.5 ]
19 14 lamp-mariadb10.2-php7.2 available \
20 [ =10.2.10_7.2.0 =10.2.10_7.2.4 =10.2.10_7.2.5 ]
21 15 libreoffice available [ =5.0.6.2_15 ]
22 16 gimp available [ =2.8.22 ]
23 17 docker=latest enabled [ =17.12.1 =18.03.1 ]
24 18 mate-desktop1.x available [ =1.19.0 =1.20.0 ]
25 19 GraphicsMagick1.3 available [ =1.3.29 ]
26 20 tomcat8.5 available [ =8.5.31 ]
Actually, install fixed version with docker=x.x.x
and skip confirmation with -y option.
1amazon-linux-extras install -y docker=18.03.1