Docker is an open-source software platform that enables developers to create, deploy, and manage applications in a wide variety of computing environments.
It provides a container-based virtualization system that allows developers to package their applications into isolated containers, which can then be deployed on any operating system or cloud platform.
With Docker, developers can quickly and easily create, test, and deploy applications without having to worry about compatibility issues or hardware requirements.
Docker Image: A Docker image is a lightweight, standalone, and executable package that contains everything needed to run an application, including the code, runtime environment, libraries, and system tools.
It provides a consistent and reproducible platform for deploying applications regardless of the underlying infrastructure or host operating system. Docker images are created from a base image by defining a set of instructions called a Dockerfile that specify how to build the image step by step.
Docker Container: A container is an isolated environment for your code. This means that a container has no knowledge of your operating system or your files.
It runs on the environment provided to you by Docker Desktop. This is why a container usually has everything that your code needs in order to run, down to a base operating system. You can use Docker Desktop to manage and explore your containers.
Dockerfile: Docker can build images automatically by reading the instructions from a Dockerfile
. A Dockerfile
is a text document that contains all the commands a user could call on the command line to assemble an image.
Docker Compose: Docker Compose is a powerful and efficient tool used to define and manage multi-container Docker applications.
It allows developers to create an application stack, describing the services, networks, and volumes needed for the containers to run seamlessly together. With Docker Compose, the orchestration of complex architectures becomes much simpler as it automates the deployment process.
Docker Daemon: The background service running on the host that manages to build, run, and distribute Docker containers. The daemon is the process that runs in the operating system to which clients talk.
Docker Client: The command line tool that allows the user to interact with the daemon.
Docker Hub: A registry of Docker images. You can think of the registry as a directory of all available Docker images. Docker registries can use them for pushing/pulling images.
Most commonly used tags in a Dockerfile:
FROM
: Specifies the base image to use for the image being built.RUN
: Executes a command during the build process.CMD
: Specifies the default command to run when the container is started.ENV
: Sets an environment variable in the container.COPY
: This copies files or directories from the host machine only into the container.ADD
: Add is similar to copy with addition it allows A URL instead of a local file/directory & extracts tar from the source directory into the destination.EXPOSE
: Exposes a specific port or ports to be used by the container.LABEL
: Adds metadata to the image in the form of key-value pairs.USER
: Specifies the user to use when running the container.WORKDIR
: As the name says, it sets the working directory for the container.
If you liked what you read, ๐ clap for the story and follow!
Happy Learning!