Docker Objects
2 min readSep 29, 2021
Dockerfile
- It is a simple text file with a set of commands or instructions.
- These commands/instructions are executed successively to perform actions on the base image to create a new docker image.
- It will help you create custom Docker images.
- Each instruction present in the docker file, represents a layer of the docker image.
Docker Images
- A Docker image is made up of a collection of files that bundle together that are essential for the application.
- It is read-only templates that you build from a set of instructions written in a Docker file.
- The docker build command builds an image from a Dockerfile by reading the instructions from a Dockerfile.
- Images define both what you want your packaged application and its dependencies to look like what processes to run when it’s launched.
- Docker images act as a set of instructions to build a Docker container, like a template.
Docker Containers
- Containers are the structural units of Docker, which are used to hold the entire package that is needed to run the application.
- A Docker container is a virtualized run-time environment of the docker images.
- In other words, we can say that the image is a template, and the container is the instance of the template.
- These containers are compact, portable units in which you can start up an application quickly and easily.
Docker Volume
- Docker volume enables the persistence and sharing of the container’s data.
- Docker volume is the Docker host’s directory mounted inside the container that allows the container to write container data into the host volumes.
- The mechanism is presented in the following diagram:
Docker network
- Docker networking enables a user to link a Docker container to as many networks as we require.
- Docker Networks are used to provide complete isolation for Docker containers.
- Docker contains the following network drivers -
Bridge — Bridge is a default network driver for the container. It is used when multiple dockers communicate with the same docker host.
Host — It is used when we don’t need network isolation between the container and the host.
None — It disables all the networking.
Overlay — Overlay offers Swarm services to communicate with each other. It enables containers to run on different Docker hosts.
Macvlan — Macvlan is used when we want to assign MAC addresses to the containers.