How to install Docker on Amazon Linux 2

Swapnasagar Pradhan
2 min readOct 15, 2022

--

The procedure to install Docker on AMI 2 (Amazon Linux 2)

  1. Login into the remote AWS server using the ssh command or connect EC2 Instance Connect (browser-based SSH connection.
  2. Apply pending updates using the yum command:

$ sudo yum update

3. Install docker, run:

$ sudo yum install docker

Amazon Linux 2: Install the docker command

4. let’s check the version and info of the docker

This tells us that, it’s not started let’s start the docker service and make it enable during boot time as well.

$ sudo service docker start ; $ sudo systemctl enable docker.service

Verification

Now that the required software is installed, we need to ensure it is working. Hence, type the following commands.
$ sudo systemctl status docker.service

To control the docker service

Use these command

sudo systemctl start docker.service #<-- start the service
sudo systemctl stop docker.service #<-- stop the service
sudo systemctl restart docker.service #<-- restart the service
sudo systemctl status docker.service #<-- get the service status

Getting docker info on Amazon Linux

That is all. You learned how to install Docker on AMI 2.

--

--

Swapnasagar Pradhan
Swapnasagar Pradhan

Written by Swapnasagar Pradhan

Husband | Father |Engineer | Sysadmin by choice | Ops by trade | love with NFT