- Docker is an open platform for developing, shipping, and running applications. (Package it once and leverage it across environments)
- Docker enables you to separate your applications from your infrastructure so you can deliver software quickly.
- With Docker, you can manage your infrastructure in the same ways you manage your applications.
Component | Category | Description |
---|---|---|
Docker Daemon | General | Docker daemon (dockerd) listens for Docker API requests and manages Docker Objects such as images, containers, networks & volumes. |
Docker Client (Optional) | General | When you use commands such as docker run, the client sends these commands to dockerd, which carries them out. The docker command uses the Docker API. The Docker client can communicate with more than one daemon. |
Dockerfile | Image | A Dockerfile is a simple text file that contains the commands to create an image. - Each instruction in a Dockerfile results in a layer. |
⭐ Docker Images | Image | An image is a read-only template with instructions for creating a Docker container. |
Docker Registry | Image | The Registry is a stateless, highly scalable server side application that stores and lets you distribute Docker images. |
⭐ Docker Containers | Container | A container packages up code and its dependencies so the application runs quickly and reliably from one computing environment to another. |
⭐ Docker Compose | Application Stack | Docker Compose define the services (with multiple containers) that make up your app in docker-compose.yml so they can be run together in an isolated environment. - It gets an app running in one command by just running docker-compose up. |
Docker Volumes | Volume | Volumes are the preferred mechanism for persisting data generated by and used by Docker containers. |
Title | Category | Command |
---|---|---|
⭐ Build Docker Image from Dockerfile | Image | docker build -t <name:tag> <DockerFile_path> . SampleDockerFile |
List Docker Images | Image | docker images |
⭐ Run a docker container from image | Container | docker run -it --cpu-rt-runtime=950000 --ulimit rtprio=99 --cap-add=sys_nice <name:tag> |
List Docker Running Containers | Container | docker ps |
Connect to Docker Container | Container | docker exec -it <container_name> /bin/sh |
⭐ Start up the application stack | Application Stack | docker-compose -f docker-compose.sample-service.yaml -f service/docker-compose.service.yaml up -d . docker-compose.sample-service.yaml |
Stop the application stack | Application Stack | docker-compose -f docker-compose.sample-service.yaml -f service/docker-compose.service.yaml down |
Check logs of the application stack | Application Stack | docker-compose -f docker-compose.sample-service.yaml -f service/docker-compose.service.yaml logs -f |
docker run
is entirely command line based, while docker-compose reads configuration data from a YAML file.docker run
can only start one container at a time, while docker-compose will configure and run multiple.
- Each layer is an image itself, just one without a human-assigned tag.
- Each instruction in a Dockerfile results in a layer. (Except for multi-stage builds, where usually only the layers in the final image are pushed, or when an image is squashed to a single layer).
- They have auto-generated IDs though.
- Each layer stores the changes compared to the image it’s based on.
- An image can consist of a single layer (that’s often the case when the squash command was used).
- Layers are used to avoid transferring redundant information and skip build steps which have not changed (according to the Docker cache).
- Docker is written in the Go programming language and takes advantage of several features of the Linux kernel to deliver its functionality.
- Docker uses a technology called namespaces to provide the isolated workspace called the container.
- When you run a container, Docker creates a set of namespaces for that container.