Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 872
isexxx Avatar asked Dec 25 '18 02:12

isexxx


People also ask

Can we install Docker on AWS?

Docker is installed on each server and provides simple commands you can use to build, start, or stop containers. AWS services such as AWS Fargate, Amazon ECS, Amazon EKS, and AWS Batch make it easy to run and manage Docker containers at scale.


2 Answers

Install Docker

sudo yum update -y
sudo yum -y install docker

Start Docker

sudo service docker start

Access Docker commands in ec2-user user

sudo usermod -a -G docker ec2-user
sudo chmod 666 /var/run/docker.sock
docker version
like image 167
Prashanth Sams Avatar answered Oct 10 '22 09:10

Prashanth Sams


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
docker version
like image 29
isexxx Avatar answered Oct 10 '22 07:10

isexxx