Introduction to Docker - Part 1

Introduction to Docker - Part 1

 

It is more likely than not that Docker and containers are going to be part of your IT career in one way or another.
 
In this blog post series I'll cover the following:
 
  •  - What are Docker images, containers and Docker Hub
  •  - Installing docker on Ubuntu Linux on a DigitalOcean droplet
  •  - Working with Docker containers
  •  - Working with Docker images
  •  - Deploying a Dockerized app
 
I'll be using DigitalOcean for all of the demos, so I would strongly encourage you to create a DigitalOcean account follow along. You would learn more by doing!
 
To make things even better you can use my referral link to get a free $50 credit that you could use to deploy your virtual machines and test the guide yourself on a few Digital Ocean servers:
 
 
Once you have your account here's how to deploy your first droplet/server:
 
 
I'll be using Ubuntu 18.04 so I would recommend that you stick to the same so you could follow along.
 

What is a container?

 
According to the official definite from the docker.com website, a container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.
 
Container images become containers at runtime and in the case of Docker containers - images become containers when they run on Docker Engine. Available for both Linux and Windows-based applications, containerized software will always run the same, regardless of the infrastructure. Containers isolate software from its environment and ensure that it works uniformly despite differences for instance between development and staging.
Containerize app Docker

Source 

 

What is a Docker image?

A Docker Image is just a template used to build a running Docker Container, similar to the ISO files and Virtual Machines. The containers is essentially the running instance of an image. Images are used to share a containerized applications. Collections of images are stored in registries like DockerHub or private registries.
 

What is Docker Hub?

 
Docker hub is the default Docker image registry  where we can store our Docker images.
 
Here's a link to the DockerHub:
 
 

Installing Docker

 
Nowadays you can run Docker on Windows, Mac and of course Linux. I will only be going through the Docker installation for Linux as this is my OS of choice. 
 
I'll deploy an Ubuntu 18.04 VM on DigitalOcean so feel free to go ahead and do the same. Once your VM is up and running, SSH to the droplet and follow along! If you are not sure how to SSH, you can follow the steps here:
 
 
The installation is really straight forward, you could just run the following command, it should work on all major Linux distros:
 
wget -qO- https://get.docker.com | sh
 
It would do everything that's needed to install Docker on your Linux machine.
 
After that setup Docker so that you could run it as a non-root user with the following command:
sudo usermod -aG docker $USER
To test Docker run the following:
docker version
And
docker info
With the docker info command we can see how many running containers that we've got and some server information.
 
The output that you would get from the docker version command should look something like this:
 
Docker Version
 
In case that you would like to install Docker on your Windows PC or on your Mac, you could visit the official Docker documentation here:
 
 
And:
 
 

Conclusion

That is pretty much it! Now you have Docker running on your machine!
 
We are ready to move to Part 2 of the Introduction to Docker blog post series:
 
 
Let me know if you have any questions!

 

Coffee For Me
Recent Posts
Proxies Demystified
Proxies Demystified
2019-11-05 09:31:05