How to install Docker on Amazon Linux 2
2 min readOct 15, 2022
The procedure to install Docker on AMI 2 (Amazon Linux 2)
- Login into the remote AWS server using the ssh command or connect EC2 Instance Connect (browser-based SSH connection.
- Apply pending updates using the yum command:
$ sudo yum update
3. Install docker, run:
$ sudo yum install docker
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.