Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
19 views8 pages

Docker

The document provides an overview of Docker, a platform for automating application deployment using lightweight containers. It explains key concepts such as Docker containers, images, commands, and networking, as well as tools like Docker Hub and Docker Compose. Additionally, it covers container lifecycle, security, and scaling, along with various commands and their purposes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views8 pages

Docker

The document provides an overview of Docker, a platform for automating application deployment using lightweight containers. It explains key concepts such as Docker containers, images, commands, and networking, as well as tools like Docker Hub and Docker Compose. Additionally, it covers container lifecycle, security, and scaling, along with various commands and their purposes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

1. What is Docker?

Docker is a platform that allows developers to automate the deployment of


applications inside lightweight containers. These containers package the
application and its dependencies, making it easy to run on any environment.

2. What is a Docker Container?


A Docker container is a lightweight, standalone, executable package that
includes everything needed to run a piece of software. It includes the code,
runtime, system tools, libraries, and settings.

3. What is a Docker Image?


A Docker image is a read-only template used to create containers. Images
contain everything needed to run an application, such as code, libraries, and
dependencies.

4. What is the difference between a Docker container and a virtual machine?


 A Docker container shares the host OS kernel and runs isolated
processes, whereas a VM runs an entire operating system (guest OS) on
top of the host OS.
 Containers are lightweight and start faster compared to VMs.

5. What is Docker Hub?


Docker Hub is a cloud-based registry service for sharing Docker images. It
allows users to find and share container images, and it serves as a central place
for managing and storing Docker images.

6. What is a Dockerfile?
A Dockerfile is a text document that contains a set of instructions for building a
Docker image. It defines the environment inside the container and automates
the image creation process.
7. What are the main Docker commands?
 docker build: Builds an image from a Dockerfile.
 docker run: Runs a container from an image.
 docker ps: Lists running containers.
 docker stop: Stops a running container.
 docker pull: Pulls an image from Docker Hub.
 docker push: Pushes an image to Docker Hub.

8. What is the purpose of the docker-compose tool?


Docker Compose is a tool for defining and running multi-container Docker
applications. It allows you to use a YAML file to configure your application's
services, networks, and volumes, then deploy them with a single command.

9. What is a Docker volume?


A Docker volume is used to persist data generated and used by Docker
containers. Volumes are stored outside the container’s filesystem and are
managed by Docker, allowing data to persist even when the container is
removed.

10. How can you share data between Docker containers?


You can share data between containers by using Docker volumes or Docker
networks. Volumes are the most common method, allowing multiple
containers to mount the same volume.

11. What is Docker networking?


Docker networking allows containers to communicate with each other and with
the outside world. Docker provides different network modes like bridge, host,
and overlay.

12. What is the difference between CMD and ENTRYPOINT in a Dockerfile?


 CMD: Provides default arguments to the ENTRYPOINT command or
specifies the command to run when the container starts.
 ENTRYPOINT: Sets the main command to run when the container starts.

13. How does Docker handle container security?


Docker uses several techniques to ensure container security, such as
namespaces (for isolation), control groups (for resource management), and
AppArmor or SELinux for additional security enforcement.

14. What is Docker Swarm?


Docker Swarm is Docker's native clustering and orchestration tool. It allows you
to manage a cluster of Docker nodes and deploy multi-container applications
with high availability and load balancing.

15. What is Docker Compose YAML file?


Docker Compose YAML file (docker-compose.yml) defines the services,
networks, and volumes for a multi-container Docker application. It allows for
easy configuration and deployment.

16. What are the different types of Docker networks?


 Bridge: The default network mode for containers.
 Host: The container shares the host’s network stack.
 Overlay: Allows containers on different Docker hosts to communicate
with each other.
 None: Disables networking for a container.

17. What is the Docker Registry?


Docker Registry is a service for storing and distributing Docker images. Docker
Hub is a public registry, but you can also create your own private registry.
18. How do you stop a running container?
You can stop a running container using the following command:
docker stop <container_id>

19. What is Docker Daemon?


Docker Daemon (dockerd) is a background service that manages Docker
containers. It handles the lifecycle of containers, images, and networks.

20. What is the difference between docker pull and docker push?
 docker pull: Downloads a Docker image from a registry.
 docker push: Uploads a Docker image to a registry.

21. What is a Docker bridge network?


A Docker bridge network is a private internal network created by Docker,
allowing containers on the same host to communicate with each other.

22. What is the use of the docker exec command?


The docker exec command allows you to run commands inside a running
container. For example, you can access the container’s shell using:
docker exec -it <container_id> bash

23. What is a Docker container lifecycle?


A Docker container lifecycle includes creation, starting, stopping, pausing, and
removal of containers. You can inspect, commit, and restart containers as
needed.

24. What is the difference between docker ps and docker ps -a?


 docker ps: Shows only running containers.
 docker ps -a: Shows all containers, including stopped ones.
25. What is Docker's "Copy-on-Write" (COW) strategy?
Docker uses a "Copy-on-Write" strategy for image layers. When a container is
created, it shares the layers of its image and only writes changes to a separate
container layer, saving space and resources.

26. How can you debug a Docker container?


You can debug a Docker container by:
 Using docker logs to view the container's output.
 Using docker exec to interact with the container directly.
 Inspecting container stats using docker stats.

27. How to run a Docker container in the background?


To run a Docker container in the background, use the -d flag:
docker run -d <image_name>

28. What is Docker's docker stats command?


The docker stats command provides real-time information about container
performance, including CPU, memory, and network usage.

29. What is the Docker Compose command to bring up all services?


To bring up all services in a Docker Compose application, use:
docker-compose up

30. What is the difference between docker run and docker exec?
 docker run: Creates and starts a new container from an image.
 docker exec: Executes a command in an already running container.
31. What is Docker's "Layered File System"?
Docker images use a layered file system, where each layer represents a set of
changes. Each time you create a new image or modify a Dockerfile, Docker
creates a new layer to add on top of the existing ones.

32. How can you scale Docker containers?


Docker containers can be scaled using Docker Compose or Docker Swarm.
Docker Swarm allows the creation of a cluster and scaling of services across
multiple nodes.

33. What is the purpose of docker pull?


docker pull downloads an image from a Docker registry (like Docker Hub) to the
local machine, allowing you to use it to create containers.

34. What is a multi-stage Dockerfile?


A multi-stage Dockerfile allows you to use multiple FROM statements in a
single Dockerfile. It helps reduce the image size by only copying the necessary
artifacts from one stage to another.

35. What are the advantages of using Docker in development?


 Portability across different environments.
 Consistency in the development and production stages.
 Isolation of dependencies and services.
 Faster application deployment.

36. What is the docker rm command used for?


The docker rm command is used to remove one or more containers that are
not running.

37. What is the docker rmi command used for?


The docker rmi command is used to remove one or more images from your
local Docker system.

38. What is a Docker swarm service?


A Docker swarm service is a long-running container that is deployed on a
Docker Swarm cluster. It can be scaled up or down and load-balanced across
multiple nodes.

39. What are the Docker container states?


Docker containers can be in various states: running, stopped, paused, or exited.

40. What is a Docker Compose file?


A Docker Compose file is a YAML file that defines services, networks, and
volumes for a multi-container application.

41. What are Docker's "Namespaces"?


Namespaces are a feature in Linux that Docker uses to provide isolation for
containers. These include process, network, mount, IPC, and user namespaces.

42. What is the difference between docker build and docker run?
 docker build: Creates a Docker image from a Dockerfile.
 docker run: Starts a container from an existing image.

43. What is Docker's docker inspect command used for?


docker inspect is used to view detailed information about containers, images,
volumes, or networks in JSON format.

44. How can you access logs from a Docker container?


You can access logs from a Docker container using the command:
docker logs <container_id>

45. What is the use of Docker’s docker attach command?


The docker attach command allows you to attach your terminal to a running
container to view its output or interact with it.

46. What is a Docker health check?


A Docker health check is used to determine whether a container is functioning
properly. If a container fails the health check, it can be automatically restarted.

47. How do you update a Docker image?


To update a Docker image, you can pull the latest version from the registry and
rebuild the container using the updated image.

48. What is the difference between docker pull and docker build?
 docker pull: Downloads an image from a registry.
 docker build: Builds an image from a Dockerfile.

49. What is a Docker network driver?


A Docker network driver is a plugin that enables containers to communicate
with each other and the outside world. Examples include bridge, host, and
overlay drivers.

50. How do you update the version of a running Docker container?


To update a running Docker container, you can:
1. Stop the current container.
2. Pull the new image version.
3. Run a new container from the updated image.

You might also like