Posted on January 13, 2023
What is docker?
Docker is a platform that allows developers to easily create, deploy, and run applications in containers. Containers are lightweight, portable, and self-sufficient environments that package all of the necessary dependencies and libraries for an application to run.
The following diagram illustrates the architecture of Docker:
+------------+
| Host OS |
+------------+
|
|
|
+------------+
|Docker Daemon|
+------------+
|
|
|
+-------------+-------------+
| Container 1 | Container 2 |
+-------------+-------------+
In this diagram, the host OS is the underlying operating system that runs on the physical or virtual machine. The Docker daemon is the background service that manages containers' creation, deployment, and running. The containers are isolated environments that run on top of the host OS and share the same kernel. Each container has its file system, network interfaces, and processes.
This architecture allows multiple containers to run on the same host while providing isolation and security. It also makes deploying and scaling applications easy, as containers can be easily moved between hosts or cloud environments.
Here is a cheat sheet of some commonly used Docker commands:
docker run - Runs a command in a new container
docker start - Starts one or more stopped containers
docker stop - Stops one or more running containers
docker rm - Removes one or more containers
docker ps - Lists all running containers
docker images - Lists all images on the local machine
docker pull - Pulls an image from a registry (such as Docker Hub)
docker push - Pushes an image to a registry
docker build - Builds an image from a Dockerfile
docker exec - Runs a command in a running container
docker logs - Shows the logs of a container
docker inspect - Provides detailed information on a container or image
docker network - Manages networks (such as creating, inspecting, and removing networks)
docker volume - Manages volumes (such as creating, inspecting, and removing volumes)
docker system - Provides information and management of the Docker system as a whole
It's important to note that these are just a few of the many commands available in Docker, and each command often has many options and flags that can be used to customize its behavior. To get more detailed information about a specific command and its options, you can use the docker [command] --help command.
https://docs.docker.com/engine/reference/commandline/docker/