Docker Interview Questions and Answers
Question - 11 : - On what circumstances will you lose data stored in a container?
Answer - 11 : -
The data of a container remains in it until and unless you delete the container.
Question - 12 : - What is docker image registry?
Answer - 12 : -
- A Docker image registry, in simple terms, is an area where the docker images are stored. Instead of converting the applications to containers each and every time, a developer can directly use the images stored in the registry.
- This image registry can either be public or private and Docker hub is the most popular and famous public registry available.
Question - 13 : - How many Docker components are there?
Answer - 13 : -
There are three docker components, they are - Docker Client, Docker Host, and Docker Registry.
- Docker Client: This component performs “build” and “run” operations for the purpose of opening communication with the docker host.
- Docker Host: This component has the main docker daemon and hosts containers and their associated images. The daemon establishes a connection with the docker registry.
- Docker Registry: This component stores the docker images. There can be a public registry or a private one. The most famous public registries are Docker Hub and Docker Cloud.
Question - 14 : - What is a Docker Hub?
Answer - 14 : -
- It is a public cloud-based registry provided by Docker for storing public images of the containers along with the provision of finding and sharing them.
- The images can be pushed to Docker Hub through the docker push command.
Question - 15 : - What command can you run to export a docker image as an archive?
Answer - 15 : -
This can be done using the docker save command and the syntax is:
docker save -o .tar
Question - 16 : - What command can be run to import a pre-exported Docker image into another Docker host?
Answer - 16 : -
This can be done using the docker load command and the syntax is
docker load -i .tar
Question - 17 : - Can a paused container be removed from Docker?
Answer - 17 : -
No, it is not possible! A container MUST be in the stopped state before we can remove it.
Question - 18 : - What command is used to check for the version of docker client and server?
Answer - 18 : -
- The command used to get all version information of the client and server is the docker version.
- To get only the server version details, we can run docker version --format '{{.Server.Version}}'
Question - 19 : - What is Docker Engine?
Answer - 19 : -
Docker daemon or Docker engine represents the server. The docker daemon and the clients should be run on the same or remote host, which can communicate through command-line client binary and full RESTful API.
Question - 20 : - Explain Registries
Answer - 20 : -
There are two types of registry is
Public Registry
Private Registry
Docker’s public registry is called Docker hub, which allows you to store images privately. In Docker hub, you can store millions of images.