Docker Flashcards
What is Docker?
https://docs.docker.com/get-started/overview/
What are Docker’s most notable features?
https://www.geeksforgeeks.org/features-of-docker/
Why should anyone use Docker? What does it offer?
https://sematext.com/glossary/docker/#:~:text=Simply%20put%2C%20Docker%20allows%20you,standardized%20way%20to%20deploy%20them.
Why should anyone use Docker? What does it offer?
https://sematext.com/glossary/docker/#:~:text=Simply%20put%2C%20Docker%20allows%20you,standardized%20way%20to%20deploy%20them.
Does Docker have any downsides?
https://www.linkedin.com/pulse/docker-an-overviewpros-cons-danish-jamil?utm_source=share&utm_medium=member_ios&utm_campaign=share_via
Name and explain the various Docker components.
https://www.spiceworks.com/tech/big-data/articles/what-is-docker/amp/
Question 5
https://www.simplilearn.com/tutorials/docker-tutorial/docker-interview-questions
What is a container?
Containers are deployed applications bundled with all necessary dependencies and configuration files. All of the elements share the same OS kernel. Since the container isn’t tied to any one IT infrastructure, it can run on a different system or the cloud.
https://www.interviewbit.com/docker-interview-questions/
Explain virtualization.
https://aws.amazon.com/what-is/virtualization/#:~:text=Virtualization%20is%20technology%20that%20you,on%20a%20single%20physical%20machine.
What’s the difference between virtualization and containerization?
https://www.liquidweb.com/kb/virtualization-vs-containerization/#:~:text=Virtualization%20relies%20on%20hypervisors%20and,agility%2C%20portability%2C%20and%20scalability.
Describe a Docker container’s lifecycle.
https://www.linkedin.com/pulse/understanding-docker-container-lifecycle-depth-rohit-kumar-shaw?utm_source=share&utm_medium=member_ios&utm_campaign=share_via
Name the essential Docker commands and what they do.
Build. Builds a Docker image file
Commit. Creates a new image from container changes
Create. Creates a new container
Dockerd. Launches Docker daemon
Kill. Kills a container
What are Docker object labels?
https://docs.docker.com/config/labels-custom-metadata/#:~:text=Labels%20are%20a%20mechanism%20for,Local%20daemons
How do you find stored Docker volumes?
https://spacelift.io/blog/docker-volumes#:~:text=All%20volumes%20are%20managed%20by,filesystem%20paths%20in%20your%20containers.
How do you check the versions of Docker Client and Server?
https://docs.docker.com/engine/reference/commandline/version/#:~:text=The%20version%20command%20(%20docker%20version,Docker%20CLI%20you%20are%20using.
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}}’
Show how you would create a container from an image.
https://www.geeksforgeeks.org/how-to-create-a-docker-container-from-an-existing-image/
To create a Docker container from an image, you use the docker run command followed by the image name. For example, docker run myimage:tag will create and start a new container based on the specified image. Additional options can be provided to configure container settings such as networking, volume mounts, environment variables, and more.
Show how you would create a container from an image.
https://www.geeksforgeeks.org/how-to-create-a-docker-container-from-an-existing-image/
command to stop the container?
Use the following command: $ sudo docker stop container name
How would you list all of the containers currently running?
Use the command: $ docker ps
What’s involved in scaling a Docker container?
https://docs.docker.com/engine/reference/commandline/service_scale/
What do you know about the Docker system prune?
https://docs.docker.com/engine/reference/commandline/system_prune/
The docker system prune command is used to clean up unused Docker resources including stopped containers, unused networks, dangling images, and unused volumes. It helps reclaim disk space and improve system performance by removing resources that are no longer needed.
Note: The docker system prune command should be used with caution as it permanently deletes unused resources. Any data associated with them will be lost.
List some of the more advanced Docker commands and what they do.
Some advanced commands include:
Docker info. Displays system-wide information regarding the Docker installation
Docker pull. Downloads an image
Docker stats. Provides you with container information
Docker images. Lists downloaded images
List some of the more advanced Docker commands and what they do.
Some advanced commands include:
Docker info. Displays system-wide information regarding the Docker installation
Docker pull. Downloads an image
Docker stats. Provides you with container information
Docker images. Lists downloaded images
Can you lose data stored in a container?
Any data stored in a container remains there unless you delete the containe
Which is the best method for removing a container: the command “stop container” followed by the command “remove the container,” the rm command by itself?
Stop the container first, then remove it. Here’s how:
$ docker stop <coontainer_id>
$ docker rm -f <container_id></container_id></coontainer_id>
Can a container restart on its own?
Since the default flag -reset is set to false, a container cannot restart by itself.
Yes, it is possible only while using certain docker-defined policies while using the docker run command. Following are the available policies:
- Off: In this, the container won’t be restarted in case it’s stopped or it fails.
- On-failure: Here, the container restarts by itself only when it experiences failures not associated with the user.
- Unless-stopped: Using this policy, ensures that a container can restart only when the command is executed to stop it by the user.
- Always: Irrespective of the failure or stopping, the container always gets restarted in this type of policy.
These policies can be used as:
docker run -dit — restart [restart-policy-value] [container_name]
How do Docker daemon and the Docker client communicate with each other?
https://docs.docker.com/get-started/overview/#:~:text=The%20Docker%20client%20and%20daemon%20communicate%20using%20a%20REST%20API,of%20a%20set%20of%20containers.
Can you implement continuous development (CD) and continuous integration (CI) in Docker?
Yes, you can. You can run Jenkins on Docker and use Docker Compose to run integration tests.
how do you create a Docker swarm?
https://docs.docker.com/engine/swarm/swarm-tutorial/create-swarm/
Why Learn Docker?
https://www.interviewbit.com/docker-interview-questions/
about docker container?
Basic question 1
https://www.interviewbit.com/docker-interview-questions/
What are docker images?
They are executable packages(bundled with application code & dependencies, software packages, etc.) for the purpose of creating containers. Docker images can be deployed to any docker environment and the containers can be spun up there to run the application.
What is a DockerFile?
Basic question 3
https://www.interviewbit.com/docker-interview-questions/
what is the functionality of a hypervisor?
https://aws.amazon.com/what-is/hypervisor/#:~:text=A%20hypervisor%20is%20a%20software,individual%20virtual%20machines%20as%20required.
Basic question 4
https://www.interviewbit.com/docker-interview-questions/
Question7
https://www.turing.com/interview-questions/docker
What can you tell about Docker Compose?
https://docs.docker.com/compose/
tell something about docker namespace?
namespace is basically a Linux feature that ensures OS resources partition in a mutually exclusive manner. This forms the core concept behind containerization as namespaces introduce a layer of isolation amongst the containers. In docker, the namespaces ensure that the containers are portable and they don’t affect the underlying host. Examples for namespace types that are currently being supported by Docker – PID, Mount, User, Network, IPC.
Advanced Question 16
https://www.turing.com/interview-questions/docker
What is the docker command that lists the status of all docker containers?
In order to get the status of all the containers, we run the below command: docker ps -a
What is docker image registry?
https://www.aquasec.com/cloud-native-academy/docker-container/docker-registry/#:~:text=Summary-,What%20is%20a%20Docker%20Registry%3F,versions%20of%20a%20specific%20image.
Basic question 9
https://www.interviewbit.com/docker-interview-questions/
What is a Docker Hub?
https://www.docker.com/products/docker-hub/#:~:text=Docker%20Hub%20is%20a%20container,repos%20for%20teams%20and%20enterprises.
What command can you run to export a docker image as an archive?
This can be done using the docker save command and the syntax is: docker save -o <exported_name>.tar <container-name></container-name></exported_name>
What command can be run to import a pre-exported Docker image into another Docker host?
This can be done using the docker load command and the syntax is docker load -i <export_image_name>.tar</export_image_name>
Can a paused container be removed from Docker?
No, it is not possible! A container MUST be in the stopped state before we can remove it.
Differentiate between COPY and ADD commands that are used in a Dockerfile?
Both the commands have similar functionality, but COPY is more preferred because of its higher transparency level than that of ADD.
COPY provides just the basic support of copying local files into the container whereas ADD provides additional features like remote URL and tar extraction support.
Intermediate Question 8
https://www.turing.com/interview-questions/docker
Can you tell the differences between a docker Image and Layer?
https://stackoverflow.com/questions/32738262/whats-the-differences-between-layer-and-image-in-docker
Intermediate Question 4
https://www.interviewbit.com/docker-interview-questions/
Advanced Question 19
https://www.turing.com/interview-questions/docker
What is the purpose of the volume parameter in a docker run command?
Intermediate Question 5
https://www.interviewbit.com/docker-interview-questions/
What does the docker info command do?
The command gets detailed information about Docker installed on the host system. The information can be like what is the number of containers or images and in what state they are running and hardware specifications like total memory allocated, speed of the processor, kernel version, etc.
Can you tell the what are the purposes of up, run, and start commands of docker compose?
Intermediate Question 8
https://www.interviewbit.com/docker-interview-questions/
What are the basic requirements for the docker to run on any system?
Intermediate Question 9
https://www.interviewbit.com/docker-interview-questions/
Can you tell the approach to login to the docker registry?
Using the docker login command credentials to log in to their own cloud repositories can be entered and accessed.
List the most commonly used instructions in Dockerfile?
Intermediate Question 11
https://www.interviewbit.com/docker-interview-questions/
Can you differentiate between Daemon Logging and Container Logging?
Intermediate Question 12
https://www.interviewbit.com/docker-interview-questions/
What is the way to establish communication between docker host and Linux host?
This can be done using networking by identifying the “ipconfig” on the docker host. This command ensures that an ethernet adapter is created as long as the docker is present in the host.
What is the best way of deleting a container?
We need to follow the following two steps for deleting a container:
- docker stop <container_id>
- docker rm <container_id></container_id></container_id>
Can you tell the difference between CMD and ENTRYPOINT?
https://spacelift.io/blog/docker-entrypoint-vs-cmd#:~:text=To%20reiterate%20what%20we’ve,supplied%20to%20the%20ENTRYPOINT%20process.
Can we use JSON instead of YAML while developing docker-compose file in Docker?
Yes! It can be used. In order to run docker-compose with JSON, docker-compose -f docker-compose.json up can be used.
How many containers you can run in docker and what are the factors influencing this limit?
There is no clearly defined limit to the number of containers that can be run within docker. But it all depends on the limitations - more specifically hardware restrictions. The size of the app and the CPU resources available are 2 important factors influencing this limit. In case your application is not very big and you have abundant CPU resources, then we can run a huge number of containers.
How to use docker for multiple application environment
Experienced Question 4
https://www.interviewbit.com/docker-interview-questions/
Question 17
https://www.turing.com/interview-questions/docker
How will you ensure that a container 1 runs before container 2 while using docker compose?
Experienced Question 5
https://www.interviewbit.com/docker-interview-questions/