IN TODAY'S EDIT
⌛ Use Case |
Docker Questions- Must to know |
🚀 Top News |
Siri's Silent Listen: Apple's $95 million privacy settlement and what it means for you |
📚️ Resources : |
Learn New Thing: Tutorial for Selenium automation testing tool lovers. |
Want to prepare for Interviews & Certifications |
Before we begin... a big thank you to Friend Support. |
Inviul is the multi niche learning platform. It covers various topics like Selenium, Appium,Cucumber, Java and many more. |
USE CASE
Docker Questions- Must to know
Basic Docker Questions:
What is Docker?
Docker is an open-source platform that automates the deployment, scaling, and management of applications using containerization.What is a Docker container?
A Docker container is a lightweight, standalone, and executable package that includes everything needed to run an application, such as code, runtime, system tools, libraries, and settings.How is a Docker container different from a virtual machine?
Containers share the host OS kernel, while VMs include a full OS instance. Containers are lightweight and faster compared to VMs.What is a Docker image?
A Docker image is a lightweight, stand-alone, and executable software package that contains everything needed to run a piece of software.What is the difference between Docker image and container?
A Docker image is a blueprint or template for containers, whereas a container is a running instance of an image.What is Dockerfile?
A Dockerfile is a script containing a series of instructions on how to build a Docker image.What is the purpose of the
docker runcommand?
Thedocker runcommand is used to create and start a container from a specified image.What is the syntax to build an image from a Dockerfile?
docker build -t <image_name> .What command is used to list running containers?
docker psHow to stop a running container?
docker stop <container_id>What is the command to remove a Docker container?
docker rm <container_id>How do you remove an image in Docker?
docker rmi <image_id>How can you check Docker logs of a container?
docker logs <container_id>What is a Docker volume?
A Docker volume is a mechanism for persisting data generated and used by Docker containers.How do you create a volume in Docker?
docker volume create <volume_name>What command is used to enter an interactive shell inside a running container?
docker exec -it <container_id> bashHow do you list all Docker networks?
docker network lsWhat is the default network mode in Docker?
The default network mode isbridge.How do you check Docker version installed on your system?
docker --versionHow do you run a container in detached mode?
docker run -d <image_name>
Intermediate Docker Questions:
How do you restart a Docker container?
docker restart <container_id>What is the difference between CMD and ENTRYPOINT in Dockerfile?
CMDprovides default arguments for an executable, whileENTRYPOINTdefines the actual executable to be run.How do you inspect details of a container?
docker inspect <container_id>What is the use of the
.dockerignorefile?
The.dockerignorefile excludes specified files and directories from the Docker build context.What is the purpose of the
docker-composetool?
Docker Compose is used to define and run multi-container Docker applications using a YAML configuration file.How do you scale containers using Docker Compose?
docker-compose up --scale <service_name>=3What is the difference between a bind mount and a volume?
A volume is managed by Docker, whereas a bind mount links a host directory to a container.How do you pass environment variables to a Docker container?
Using the-eflag:docker run -e VAR_NAME=value <image_name>What is a multi-stage build in Docker?
Multi-stage builds allow using multipleFROMinstructions to optimize the final image size by discarding unnecessary build artifacts.How do you copy files from a running Docker container to the host?
docker cp <container_id>:/path/to/file /host/pathHow do you set resource limits for a container?
Using flags such as--memoryand--cpuin thedocker runcommand.What are Docker namespaces?
Docker namespaces provide isolation of resources such as PID, network, and file systems between containers.What is Docker Swarm?
Docker Swarm is a native clustering and orchestration tool for managing Docker containers across multiple nodes.What is a Docker Registry?
A Docker registry is a storage and distribution system for Docker images, such as Docker Hub or private registries.How do you push an image to Docker Hub?
docker push <username>/<image_name>:<tag>What is the difference between
docker stopanddocker kill?docker stopgracefully shuts down a container, whereasdocker killforcefully terminates it.How do you expose a port while running a container?
docker run -p 8080:80 <image_name>How can you configure a container to restart automatically?
Using--restartflag with options likealways,on-failure, etc.What is the purpose of the
docker prunecommand?
It removes unused containers, networks, and images to free up disk space.What is an overlay network in Docker?
An overlay network allows containers running on different Docker hosts to communicate.
Advanced Docker Questions:
How do you secure Docker containers?
By using practices such as image scanning, limiting privileges, enabling seccomp profiles, and using network segmentation.What is the difference between Docker and Kubernetes?
Docker is a containerization platform, whereas Kubernetes is an orchestration system to manage containerized applications.How can you debug a failed Docker build?
By using the--progress=plainflag and analyzing each build step.What are Docker storage drivers?
Storage drivers manage how Docker writes and reads images and containers, such asoverlay2,aufs, etc.What is the significance of the
HEALTHCHECKinstruction in Dockerfile?
It provides a way to monitor the health of a running container.How do you deploy a containerized application in production?
Using orchestration tools like Kubernetes, Docker Swarm, or ECS.What are Docker secrets, and how do they work?
Docker secrets securely store and manage sensitive data, such as passwords and API keys, in Docker Swarm mode.What is BuildKit in Docker?
BuildKit is an advanced build backend that improves performance and caching in Docker builds.How does Docker ensure isolation between containers?
Through technologies such as cgroups, namespaces, and kernel features.What are the best practices for writing a Dockerfile?
Use minimal base images
Leverage caching effectively
Avoid unnecessary layers
Use multi-stage builds
Keep the image size small