In this article, I will explain how you can install Docker into your Ubuntu instance in AWS / GCP, which can help you to setup Docker for your production environment. But before that, let’s discuss what is Docker.
Table of Contents
What is Docker
Docker is a set of the platform as service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries, and configuration files; they can communicate with each other through well-defined channels.
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.
Here I have shown, how to create a new instance in GCP Then installed Docker Over there Then run Hello-world, but you can apply the same strategy to AWS as well. The steps are given below, so you can follow along.
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.
sudo docker run hello-world
This command will pull the image ‘Hello-world’ from docker hub and then run it instantly. If you have successfully setup everything, then you should be able to see “Hello World” message in your terminal.
So everything, that I described above is shown into this video as well, which help you to try this example from your own AWS account.
Conclusion
So in this article, I have shown how can you install Docker in Ubuntu 18. Docker is the most popular container management system in this world, and if you are planning to grow your career as a DevOps professional then docker is the tool that you must learn. I hope this might helped you to start with AWS and Docker and if you stuck on any issues feel free to contact me via [email protected] or call me @ +8801554306975