Docker for Beginners: A Comprehensive Guide

Nov 8, 2023ยท

3 min read

Have you ever felt like you're drowning in a sea of tools and technologies? As a DevOps engineer, you know the feeling all too well. With so many things to learn and master, it can be hard to keep up. But there's one tool that can make your life a lot easier: Docker.

What is Docker?
Docker is a containerization platform that lets you build, run, and manage applications in isolated containers. This means you can develop your applications on one machine and deploy them on another without any problems. Docker is also great for managing microservices, which are small, independent applications that can be easily deployed and scaled.

Docker Architecture
The following diagram shows Docker architecture:

Docker uses a client-server architecture that consists of three main components:

  1. Docker Client: The Docker client is a command-line interface (CLI) tool that allows you to interact with the Docker daemon. You can use the Docker client to build, run, manage, and distribute Docker containers.

  2. Docker Daemon: The Docker daemon is a background process that runs on the Docker host. The Docker daemon is responsible for managing Docker containers, including creating, running, stopping, and destroying containers. The Docker daemon also communicates with the Docker client to execute Docker commands.

Docker Registry: The Docker registry is a public or private repository where Docker images are stored. You can use the Docker registry to share Docker images with other users.

Here are some additional key components of the Docker architecture:

  1. Docker Images: A Docker image is a read-only template that contains the instructions for creating a Docker container. A Docker image can include an operating system, application code, and other dependencies.

  2. Docker Containers: A Docker container is a running instance of a Docker image. A Docker container is isolated from other containers and from the host system. This isolation makes it possible to run multiple containers on a single host without worrying about conflicts.

  3. Docker Networking: Docker containers can communicate with each other using Docker networking. Docker networking is based on the Linux network namespaces.

  4. Docker Storage: Docker containers use the host system's storage to store their data. Docker also supports volumes, which are persistent storage volumes that can be shared between containers.

How to install Docker?

For Ubuntu:
sudo apt update
sudo apt install

For Fedora:
sudo dnf install docker

For CentOS:
sudo yum install docker

For MacOS:

curl -o docker.dmg
sudo hdiutil create -format UDRO docker.dmg -size 200m -name docker
sudo hdiutil attach -mountpoint /Volumes/Docker docker.dmg
sudo mkdir -p /Library/Applications
sudo ln -s /Volumes/Docker/ /Library/Applications/
sudo eject /Volumes/Docker

For Windows:

  1. Download the Docker Desktop Installer for Windows from the Docker website.

  2. Double-click the Docker Desktop Installer.exe file to run the installer.

  3. Follow the on-screen instructions to install Docker Desktop.


After installing docker, run the following commands:

  • Use the docker run command to start a new container and interact with it through the command line.
    docker run hello-world

  • Use the docker inspect command to view detailed information about a container or image.
    docker inspect <container_id>

  • Use the docker port command to list the port mappings for a container.
    docker port <container_id>

  • Use the docker stats command to view resource usage statistics for one or more containers.
    docker stats <container_id>

  • Use the docker top command to view the processes running inside a container.
    docker top <container_id>

  • Use the docker save command to save an image to a tar archive.
    docker save hello-world > hello-world.tar

  • Use the docker load command to load an image from a tar archive.
    docker load < hello-world.tar

    Thank you!