"Diving into Docker: Unleashing the Container Magic"

It all started in the early 1960s, the new era of virtual machines which allowed humans to run multiple apps on a single system even though it was all time and space-consuming thing. Then comes our superstar DOCKER which resolved all these problems.

What is Docker?

Docker is an open-source platform that enables developers to build, package, and distribute applications as lightweight containers. Containers are like small, standalone environments that contain everything an application needs to run, including code, runtime, system libraries, and settings. This eliminates the most common problem "it works on my machine", which use to happen when people had different Operating systems (OS). As containers ensure consistency across different environments.

Benefits of Docker?

Docker is a game-changer for software. It puts apps and all the software required to run that application in portable boxes called containers, so they can run consistently anywhere. When it's time to show off your app, Docker packs it up super quickly. Docker also helps in sharing applications through Docker-Images. Docker talks to other tools, making developers happy. Docker also guards apps by providing better security to the applications.

sndkj

Docker Architecture

Run-Time :

  • Used to stop n start containers.

    -runc [ Works with OS to stop n start containers ]

    -containerd [Manages runc and helps in connecting with network ]

Docker Engine :

  • It provides the interface to interact with Daemon.

  • DAEMON : It listens to the API requests being made through the Docker client and manages Docker objects such as images, containers, networks, and volumes.

  • CLIENT : This is what you use to interact with Docker. When you run a command using docker, the client sends the command to the daemon, which carries them out. The Docker client can communicate with more than one daemon.

Orchestration :

  • Allows to manage containers.

Docker/Container Image

Most of the time people get confused between " Image and a Container".

  • Docker Image :

    • A Docker image is like a snapshot of the Application. It has everything needed for a program to run, like the program itself, its tools, and settings. It's like a self-contained box that you can easily share with others. We use Docker images to quickly start and run programs in a consistent way, no matter in which OS we are running them.

    • Docker images are created by using Docker Files.

    • Every Docker image is a combination of multiple layers.

    • No docker image is mutable.

  • Container :

    • These are the running instances of an image. Here is where all your images run with the help of Docker API or CLI. We can manage storage, and create new images. All the data of the images is also stored inside containers.

Getting into the commands :

It is advised to have a basic knowledge of all the Linux commands as few commands have a direct implementation on it.

  • To run any image we can use

    -->Docker run image-name

  • To run Ubuntu in the terminal

    -->Docker run -it ubuntu

  • To download Docker images from the web

    -->Docker pull mongo

  • To show all the images on desktop

    -->Docker images

  • To display all the containers

    -->Docker container ls

  • To show the process status

    -->Docker ps -a

  • To stop a specific image

    -->Docker stop "container-id"

  • To get the information on all the docker images

    -->Docker inspect "container-id"

  • To delete all the stopped containers

    -->Docker container prune -f

  • To restart a container again

    -->Docker start "container-id"

  • To run a server using docker

    -->Docker run ping www.google.com

  • To run a server in a detached mode

    -->Docker run ping -d www.google.com

  • To show the activity of the container

    -->Docker logs "container-id"

  • To remove the image from the desktop

    -->Docker rmi "image-name" -f

  • To commit an existing image to a new image

    --> Docker commit -m "msg" "container-id "new-image name"

  • To build a new image

    -->Docker build -t "image-name"

    What's next?

    There are many opportunities that you can grab and a few of them are :

    1. Docker Compose

    2. Orchestration and Kubernetes

    3. Continuous Integration and Continuous Deployment (CI/CD)

    4. Microservices Architecture

    5. Infrastructure as Code (IaC)

    6. Cloud Services

    7. Security

    8. Monitoring and Logging

    9. Networking

    10. Advanced Docker Topics

Focus on areas that align with your interests and career goals, and consider working on real-world projects to solidify your skills.