Full Information About Docker

Arjun Y
Cypik

--

Docker overview

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. that Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code, you can significantly reduce the delay between writing code and running it in production.

What can I use Docker for?

Fast, consistent delivery of your applications

Docker streamlines the development lifecycle by allowing developers to work in standardized environments using local containers which provide your applications and services. Containers are great for continuous integration and continuous delivery (CI/CD) workflows.

Consider the following example scenario:

  • Your developers write code locally and share their work with their colleagues using Docker containers.
  • They use Docker to push their applications into a test environment and run automated and manual tests.
  • When developers find bugs, they can fix them in the development environment and redeploy them to the test environment for testing and validation.
  • When testing is complete, getting the fix to the customer is as simple as pushing the updated image to the production environment.

Docker architecture

Docker uses a client-server architecture. The Docker client talks to the Docker daemon, which does the heavy lifting of building, running, and distributing your Docker containers. The Docker client and daemon can run on the same system, or you can connect a Docker client to a remote Docker daemon. The Docker client and daemon communicate using a REST API, over UNIX sockets or a network interface. Another Docker client is Docker Compose, which lets you work with applications consisting of a set of containers.

The Docker daemon

The Docker daemon (dockerd) listens for Docker API requests and manages Docker objects such as images, containers, networks, and volumes. A daemon can also communicate with other daemons to manage Docker services.

The Docker client

One of the main ways Docker users interact with Docker is through the Docker client. The Docker client sends commands such as “docker run” to dockerd, which then carries out these commands. The Docker client uses the Docker API and can communicate with multiple daemons.

Docker registries

A Docker registry stores Docker images. Docker Hub is a public registry that anyone can use, and Docker looks for images on Docker Hub by default. You can even run your own private registry.

When you use the docker pull or docker run commands, Docker pulls the required images from your configured registry. When you use the docker push command, Docker pushes your image to your configured registry.

Images

An image is a read-only template with instructions for creating a Docker container. Often, an image is based on another image, with some additional customization. For example, you may build an image that is based on the Ubuntu image but installs the Apache web server and your application, as well as the configuration details needed to make your application run.

Containers

A container is a runnable instance of an image. You can create, start, stop, move, or delete a container using the Docker API or CLI. You can connect a container to one or more networks, attach storage to it, or even create a new image based on its current state.

By default, a container is relatively well isolated from other containers and its host machine. You can control how isolated a container’s network, storage, or other underlying subsystems are from other containers or the host machine.

A container is defined by its image as well as any configuration options you provide to it when you create or start it. When a container is removed, any changes to its state that aren’t stored in persistent storage disappear.

General system requirements

To install Docker Desktop successfully, your Linux host must meet the following general requirements:

  • 64-bit kernel and CPU support for virtualization.
  • KVM virtualization support. Follow the KVM virtualization support instructions to check if the KVM kernel modules are enabled and how to provide access to the KVM device.
  • QEMU must be version 5.2 or later. We recommend upgrading to the latest version.
  • systemd init system.
  • Gnome, KDE, or MATE Desktop environment.
  • For many Linux distros, the Gnome environment does not support tray icons. To add support for tray icons, you need to install a Gnome extension. For example, AppIndicator.
  • At least 4 GB of RAM.
  • Enable configuring ID mapping in user namespaces, see File sharing.
  • Recommended: Initialize pass for credentials management.

Docker Desktop for Linux runs a Virtual Machine (VM). For more information on why, see Why Docker Desktop for Linux runs a VM.

How To Install and Use Docker on Ubuntu

Step 1 — Installing Docker

First, update your existing list of packages:

sudo apt update

Next, install a few prerequisite packages that let apt use packages over HTTPS:

sudo apt install apt-transport-https ca-certificates curl software-properties-common

Then add the GPG key for the official Docker repository to your system:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add the Docker repository to APT sources:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

Finally, install Docker:

sudo apt install docker.io

Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running:

sudo systemctl status docker

DOCKER USEFUL COMMANDS

Docker build;

sudo docker build -t image . 

how to show docker images;

sudo docker images

how to run image;

sudo docker run image

how to see running containers;

sudo docker ps 

how to see all containers;

sudo docker ps -a 

how to docker containers port mapping;

docker run -p 8080:80 image

how to go under the container/how to go in the container;

sudo docker exec -it container id  -/bin/bash

docker image tag;

 sudo docker image tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]

how to push image at Dockerhub;

sudo docker push image tag 

Enjoy it! That’s It; we are done…

For hassle-free Cloud Management with DevOps at the center of the process, contact us at info@cypik.com
Cypik

About the author:
I’m Arjun , a dedicated Linux and DevOps engineer with a strong focus on automating development processes. Currently, I’m part of the team at Cypik, where I specialize in cloud technologies, with a keen expertise in Azure AKS and Terraform. My work revolves around enhancing software delivery and infrastructure management to optimize efficiency and scalability

--

--