ITZone

Learn about docker

1. What is Docker?

Docker is a platform that provides developers with an easy way to build, deploy and run applications using containers (virtualization platform). Initially, Docker was written in Python but now it has migrated to Golang.

2. Docker Key Components

3. Why use Docker?

4. What is Dockerfile? How to create a Docker Image from Dockerfile?

Docker will build Docker Image automatically by reading the instructions declared in a file named  Dockerfile. Dockerfile is a text file containing all the instructions that the user wants to execute to create a  Docker Image.

Some commonly used commands in Dockerfile

Then we point to the directory containing the Dockerfile and run the command docker build ./ and see the results:

After the build is successful, we execute run Image with the command:

5. How to create Docker Image on Docker Hub:

To create a Docker Image on Docker Hub we need to perform the following steps:

  1. Create an account and login to the site hub.docker.com
  2. Find and click Create Repository
  3. Fill in the required information and select public
  4. Log in to Docker Hub using the command line:

  5. Check the ID of the image to use:

    $ sudo docker images

    If the image is not tagged, tag it with the command:

  6. To upload an Image to Docker Hub you need to use the command:

6. Summary of commands when manipulating Docker Containers:

Here are the operations commonly used with Docker Containers, in addition, there are many other commands you can refer to at This

7. Summary of commonly used commands when manipulating Docker Image:

8. What is Docker Volume?

As we all know, the characteristic of Docker Container is that they run independently, and do not affect each other, but for some reason, we want to share data between Containers for example, you have 1, 2, 3 web servers nginx and expect when they share the same config files, or static html. Luckily docker provides volumes to do that.

Docker volume is a volume created that allows containers to mount the volume into containers or more easily docker uses that volume instead of a container’s folder. In terms of operation  Volume is similar to Bind mounts, but Volume is managed by Docker. While bind mounts, the file or directory to be mounted must exist on the docker host.Volume works on both Linux and Windows containers.

When to use Volume?

9. What is Docker Compose?

Docker compose is a tool used to define and run multi-containers for Docker applications. With Compose you use the YAML file to configure the services for your application. Then use the command to create and run from those configs.

To use Docker Compose it only takes three steps:

The syntax used in the Docker Compose config file:

Summary:

In this article, I mainly introduce the theory so that I can understand Docker and the main components of Docker. In the process of writing articles, I also need to learn and learn a lot of new things. I look forward to hearing from you in the comments section below! Thank you for listening to my sharing.

Share the news now