The objective of this blog post is to give you a full overview of what Docker is, its components, how it works, and more.
Here’s everything we’ll cover:
- What is Docker?
- Docker Architecture
- How Docker Works
- Docker Pricing
- Docker Advantages and Disadvantages
- Docker Use Cases
- Docker vs Virtual Machines
- Learn Docker on Cloud Academy
What is Docker?
Docker is a platform that enables quick application development through Containers. Using containers, developers can package up an application with all its dependencies and ship it out as one package. This makes deploying and managing applications much more accessible, especially in a cloud-based or microservices-based architecture.
Containers are standardized units containing all dependencies and environments to develop and run a given application. Containers are a lightweight, stand-alone, executable package that includes everything needed to run a piece of software, including code, runtime, system tools, system libraries, and settings.
You can learn more about Docker on Cloud Academy. For complete beginners, Cloud Academy has an introductory course, Introduction to Docker.
Docker is built on a client-server model. The Docker client communicates with the Docker daemon, which is in charge of building, running, and distributing your Docker containers.
A Docker client and daemon can run on the same system, or a Docker client can connect to a remote Docker daemon. The Docker client and daemon communicate via a REST API, UNIX sockets, or a network interface. Docker Compose is another Docker client that allows you to work with applications made up of a collection of containers.
The Docker architecture consists of these main components:
- Docker Client
- Docker Deamon
- Docker Registries
- Docker Desktop
- Docker Objects:
- Docker Images
- Docker Containers
The Docker client is a tool that allows users to interact with Docker servers. It provides a command-line interface (CLI) that can be used to issue commands to the server, as well as a graphical user interface (GUI) that can be used to manage Docker servers. The Docker client talks to the Docker daemon, sending it the commands to build, run, and stop containers. The Docker client and daemon can run on the same system or connect a Docker client to a remote Docker daemon. The Docker client and daemon communicate via sockets or through a RESTful API.
The Docker daemon (dockerd) listens for Docker API requests and manages Docker objects such as images, containers, networks, and data volumes. A single Docker daemon can manage multiple containers and images. When you install Docker, a dockerd daemon is automatically configured and launched.
A registry is a collection of repositories, and a repository is a collection of images. Docker Hub is a public registry that contains many Docker images. You can also run your own private registry.
Docker Desktop is an application for macOS and Windows machines to create and manage Docker containers. With Docker Desktop, you can develop and test your applications locally, then deploy them to production with confidence. Docker Desktop includes everything you need to build, test, and ship your applications.
Docker Desktop is the easiest way to run Docker on your desktop. If you’re new to Docker, you can start with the Docker Basics course. Docker Desktop is free to download and use.
Images are read-only templates used to create Docker containers. Images are created with the build command and can be pushed to a registry with the push command. The Docker Hub maintains a collection of official images, and you can browse the Docker Hub to find your needed images.
A container is a runtime instance of a Docker image—what the image becomes in memory when executed. It runs completely isolated from the host environment by default, only accessing host files and ports if configured.
Docker networks: Networks are used to enable communication between containers. By default, containers can communicate with each other by their container ID. You can also create user-defined networks.
How Docker Works
How Docker works is very simple. When you install Docker, it creates a virtual environment on your computer. This virtual environment is completely isolated from your main Operating System (OS), making it very secure.
Docker containers can hold any application. When you want to run a container, you tell Docker which image you want to use and what command you want to run. Docker will then fetch the image and run the command inside the isolated environment.
Docker images are built from instructions called Dockerfiles. A Dockerfile is just a text file containing a list of commands that must be run to build the image. For example, an image could be built from a Dockerfile that installs Apache and copies over some static HTML files.
When you run a command in a Docker container, the output of that command is displayed on your screen. But, the changes made to the files inside the container are not saved when the container is stopped. You must create a new image from the container to save the changes.
Creating a new image from a container is called committing. To commit a container, you use the docker commit command. This command takes the container ID and a name for the new image. For example, if you wanted to save the changes made to a container with the ID of 1234 as a new image called “my-image”, you would run the following command:
$ docker commit 1234 my-image
Once you have achieved a new image, you can push it to a Docker registry so that others can use it. Docker registries are websites where images can be stored and shared. The largest and most popular registry is Docker Hub.
To run a Docker container, you first must pull the image from the registry. For example, if you wanted to run the “my-image” image that you pushed to Docker Hub, you would use the following command:
$ docker run my-image
This would start a new container from the “my-image” image and run it on your computer.
Docker pricing is based on the repository size, the number of users and the level of support required. Four payment plans are offered, including a free community edition and a paid enterprise edition:
- Docker Personal: A free edition of Docker comes bundled with unlimited repositories, and 200 image pulls every 6 hours.
- Docker Pro: Priced at 5 USD per month. Bundled with 5000 image pulls a day with up to 5 concurrent builds.
- Docker Team: Priced at 9 USD per user per month, with a minimum of 5 users
- Docker Business: Priced at 24 USD per month, with a minimum of 5 users.
Below is a table comparing what the packages offer:
|0 USD||5 USD/Month||9 USD/User/Month||24 USD/User/Month|
Unlimited public repositories
Unlimited Scoped tokens
Docker engine + Kubernetes
|200 image pulls / 6 hours||5000 image pulls / day||Unlimited image pulls||Unlimited image pulls|
|/||5 concurrent builds||15 concurrent builds||15 concurrent builds|
|/||/||Can add users in bulk||Can add users in bulk|
|/||/||Audit Logs||Audit Logs|
|/||/||/||Purchase via invoice|
|/||/||/||Volume pricing available|
Docker Advantages and Disadvantages
There are multiple reasons to use Docker.
Docker enables developers to package applications with all the dependencies needed and ship them out as self-contained units. This way, you can run the same application on different machines without worrying about different environments causing issues.
Docker also makes it easy to set up development environments quickly. You can use a pre-built image from Docker Hub or create your own and have a complete environment up and running in minutes.
There are also several security benefits to using Docker. By running each application in its own isolated container, you can limit each access to the underlying host system. This can help to prevent one compromised container from giving an attacker access to the rest of the system.
The main reason not to use Docker is that it can add complexity to your development workflow. If you are working on a team of developers, you must ensure that everyone uses the same version of Docker and that your application containers are compatible.
There are many reasons why someone might choose to start using docker. Some common reasons include wanting to increase the efficiency of their development workflow, creating a more consistent development environment, or reducing the time and effort required to set up and maintain a development environment.
Docker Use Cases
Docker has multiple use cases, as follows:
- Docker can be used for spinning up testing and development environments quickly and easily.
- Docker can also be used for shipping and deploying applications – you can build your app in a Docker image and then ship it to your Production environment, where it will run in a Docker container.
- Docker can also be used for creating microservices-based applications.
- Docker can also be used to orchestrate and manage large numbers of containers.
Docker vs Virtual Machines
Docker and Virtual Machines differ in many aspects, such as architecture, security, etc.
If you want to have a full comparison between them, check the Docker vs. Virtual Machines: Differences You Should Know‘s article on the Cloud Academy’s blog.
Learn Docker on Cloud Academy
Here’s a full list of training content on Docker that you can find in the Cloud Academy Library:
- Docker in Depth – Learning Path
- Introduction to Docker – Course
- Docker Basics – Lab Challenge
- Using Docker file and Docker compose to build and run containers – Lab
- Docker Compose – Course
- Getting started with Docker on Windows – Lab
We hope this blog post helped you understand Docker’s multiple aspects and features. If you have thoughts or questions, feel free to leave a comment or contact Cloud Academy.
Thanks and Happy Learning!