Docker Install in AWS

How to Install Docker in Ubuntu 18

Docker can help to make like easy for developers and DevOps. The beauty of docker is it runs anywhere. So you don’t need to worry about your production environment.

Create Instance

At first you need to create an instance in AWS or GCP. I have some articles on how you can create instance on AWS here.

Then connect to that Instance

Next, we need to connect to that instance. There are many ways to connect to an instance like Putty / Terminal or Console form AWS or GCP. If you want to connect from Putty then follow my other article here.

sudo apt-get update

Next, we want to update the package list. The command written above sudo apt-get update is used to download package information from all configured sources. The sources often defined in /etc/apt/sources.list file and other files located in /etc/apt/sources.list.d/ directory. So when you run the update command, it downloads the package information from the Internet. It is useful to get info on an updated version of packages or their dependencies.

sudo apt-get install docker.io

This single line of Code will install Docker in Ubuntu 18. So if you have followed my steps properly then you have successfully installed Docker on your Ubuntu instance in AWS / GCP. Congratulations

The next commands are for showing an example of how you can pull and run images from docker hub.

sudo docker ps

This command is an important command when you will be managing your docker containers. This command will list all the containers that are running in this instance. So from there, you can get the running container id and image name, etc., which you can use in your other docker commands.

sudo docker ps -a

This command is exactly the same as the other one, but the only difference is that it shows the stopped container as well. So the previous command shows the running container and this command shows running and stopped containers.