Docker Tutorial for Beginners

Docker’s core concepts are containers and images.

Images are the software inside your container.

Containers are a running instance of an image.

You should have docker installed and running before proceeding

How to get images

You can pull (download) or push (upload) images to and from Docker Hub


You can also use your terminal to search for images instead.

docker search <image name>


Let’s get the Debian image since it’s ~500MB smaller than Ubuntu.

docker pull debian 

To view all your images run

docker images

and you will see the Debian image you just pulled.


How to start containers

Containers are built from images using the run command.

docker run <image-id>

The image’s ID was listed in the previous command. In my case

docker run 1b088884749b

You wont receive output because the container ran and stopped. But it was created.

docker ps -a


How to make your own image

Creating your own image allows you to share your project with others.

Let’s create our own image built on top of the base image (Debian) and install vim on it.

The following command allows us to run commands within the image.

docker run -it <image-id> /bin/bash

After which you’ll be inside the container


Update the package manager and install Vim

apt-get update -y && apt-get install -y vim

You can now exit the container


In order to convert the container into an image you must commit the changes

docker commit <container-id> <your-images-name>

Remember to get the container id by running docker ps -a. The one you just exited out of will be the first one on top.

Running docker images will list your images including the new one you created.


This image can now be pushed to Docker Hub for others to pull.

Now that you know the basics, I recommend heading over to the docs for more info.

Thanks for reading and good luck!