- What is Docker and why is it used? Docker is an operating system for containers. It is use to build, start, or stop containers.
- What is a Docker image and how is it different from a Docker container? A Docker image is a template that defines how a container will be realized. A Docker container is a runtime instance of a Docker image.
How do you create a Docker image and run a Docker container?
How to Create Docker Image >
Create a Base Container > Inspect Images > Inspect Containers
Start the Container > Modify the Running Container > Create
an Image From a Container > Tag the Image > Create Images
How to run Docker Container
Get the sample application. If you have git, you can clone
the repository for the sample application > Explore the
Dockerfile > Build your first image > Run your container >
Verify that your container is running.
What is a Dockerfile and how do you use it to create a Docker image?
A Dockerfile is simply a text-based file with no file extension that contains a script of instructions. Docker uses this script to build a container image. In the app directory, the same location as the package.json file, create a file named Dockerfile .
How can you inspect the contents of a Docker container and the changes made to a container while it was running?
How can you share a Docker image with others and pull an image from a Docker registry?
To pull the Docker image from a private registry, users are required to start the registry container. Then, log in to the private registry. After that, utilize the “docker pull ” command to pull the Docker image from Docker private registry.
What are the different network modes available in Docker and how do you choose the right network mode for your application?
How can you mount a volume in a Docker container and share data between the host and container?
You can mount host volumes by using the -v flag and specifying the name of the host directory.
What is the difference between a Docker Compose file and a Dockerfile, and how are they used in deploying multi-container applications?
The key difference between the Dockerfile and docker-compose is that the Dockerfile describes how to build Docker images, while docker-compose is used to run Docker containers.
How can you monitor the performance of a Docker container and diagnose issues with it?
** You can use the docker stats command to live stream a
container's runtime metrics. The command supports CPU, memory
usage, memory limit, and network IO metrics. The docker stats
reference page has more details about the docker stats
Components of Docker and its Brief Summary
The basic components include Docker client, Docker image, Docker Daemon, Docker Networking, Docker registry, and Docker container, whereas Docker Compose and Docker swarm are the advanced components of Docker.
What is the difference between docker pause and unpause?
The main difference between the paused and stopped states is
that the memory portion of the state is cleared when a
container is stopped, whereas, in the paused state, its
memory portion stays intact.
What is the difference between docker stop and kill?
This means the difference between docker stop and docker
kill is that - stop can allow safe termination (within the
grace period) while kill terminates immediately. A container
that is in the created state or stopped can be removed with
What is the difference between docker exec and attach?
** When you run an exec, it will basically spins up a new
process inside the container whereas attach basically lets
you attach to an existing process inside the container.**
List of dockerfile instructions and its Brief Summary?
User - Change user & group membership
Copy - Copy directories and files to the image
Add - Copy directories and files to the image
Run - Carry out the command in image in the course of build process
What is the difference between CMD vs Entry
The main difference between CMD and ENTRYPOINT in Docker is that execution-wise, the default arguments provided by CMD can get overridden, whereas those provided by ENTRYPOINT cannot.
For further actions, you may consider blocking this person and/or reporting abuse