Docker Internals

Level : Beginner
Mentor: Shailendra Chauhan
Duration : 00:03:00

Docker Container Life Cycle​

Docker containers have a lifecycle that includes creation, running stopping, and removal. Containers are built from Docker images, run as separate instances, can be terminated or paused, and removed when no longer required.

Process (lifecycle) of a Docker Container

The Docker container life cycle method is listed below:

  • Create a container
  • Run the container
  • Pause the container (optional)
  • Unpause the container (optional)
  • Start the container
  • Stop the container
  • Restart the container
  • Kill the container
  • Destroy the container

Valuable States of Docker Container

  • Running
  • Paused
  • Restarting
  • Exited

Docker Engine

The Docker engine, sometimes known as Docker, is a client-server application that creates and runs containers using Docker components.

What is the Docker CLI?

Docker CLI is a command-line interface that allows you to interact with the Docker engine to create, build, and execute Docker images, containers, volumes, and networks. Docker CLI is used to interact with the Docker Engine through APIs.


Basic Docker Commands

There are a few Docker commands. If we simply run docker from the console, we can access all of the commands.

  • Attach
  • Build
  • Commit
  • Cp
  • Create
  • Diff

Benefits of Docker CLI

  • Portability: Guarantees consistency in different environments.
  • Efficiency: Graphical applications that use fewer resources than traditional ones.
  • Scriptable: It can be used in conjunction with other command-line tools to automate tasks.
  • Flexibility: Enables more advanced commands and choices that are not available in the GUI.
  • Customization: Users can develop their scripts and workflows to fit their needs.

Limitations of Docker CLI

  • Learning curve: It may be challenging for beginning programmers to use.
  • Security: Since it is frequently run in root mode, it may cause unintended side effects.
  • Limited Visual Feedback: It is difficult to execute and use applications that require continual visual feedback.
  • Debugging: Without visual help, issues can be more difficult to troubleshoot.
  • Manual Updates: To receive the most recent features and security patches, users must manually upgrade the Docker CLI.

Docker Volumes

Docker volumes store container data, allowing several containers and the host system to share information without increasing container size. They survive container deletion, ensuring data continuity & flexibility in storage management. Docker volumes are useful for running databases as containers to store data.

The command for creating and deleting volumes in Docker

We can create a volume using the following command

$ docker volume create <volume name>

We may remove the volume by using the command below

$ Docker volume prune

Different Kinds of Volume Mount Types in Docker

The volume mount type used by Docker is as follows:

  • Bind mounts 
  • Volumes 
  • tmpfs mounts 

To verify if a volume has been properly created and mounted in Docker

To ensure that the volume was properly built and mounted, use docker inspect devtest.

Self-paced Membership
  • 24+ Video Courses
  • 825+ Hands-On Labs
  • 400+ Quick Notes
  • 125+ Skill Tests
  • 10+ Interview Q&A Courses
  • 10+ Real-world Projects
  • Career Coaching Sessions
  • Email Support
Upto 60% OFF
Know More
Still have some questions? Let's discuss.
CONTACT US
Accept cookies & close this