Docker – Install on Amazon Linux 2

This tutorial shows how to install Docker on the Linux machine (Amazon Linux 2).

Check OS

cat /etc/os-release

Switch User to super user

sudo su

Update the System

yum update -y
 
yum install -y yum-utils
yum install -y device-mapper-persistent-data
yum install -y lvm2

Install Docker

yum search docker

yum install docker -y

Add a user to the docker group

usermod -a -G docker user_name
 
exit
 
docker version
  • To make a user to access docker, you need to log out and log in again.

Start Docker

sudo systemctl enable docker
sudo systemctl start docker
 
docker image ls

Run a Image and Check the container

docker container run hello-world
 
docker image ls
docker container ls -a
docker container ps -a
 
docker container inspect d9605d9e14f0
docker container rm d9605d9e14f0
docker container ls -a
 
docker image rm hello-world
docker image ls

Stop Docker

sudo systemctl stop docker

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s