Docker-Bundle Flashcards
(40 cards)
What is Docker?
Docker is an open-source platform for developing, shipping, and running applications inside lightweight, portable containers.
What are Docker containers?
Docker containers are isolated environments created using Docker, where applications can run with their dependencies.
How does Docker differ from virtual machines?
Docker containers share the host system’s kernel, are more lightweight, and start faster compared to virtual machines that have full-blown operating systems.
What is a Docker image?
A Docker image is a lightweight, standalone, executable package that includes everything needed to run a piece of software, including the code, runtime, libraries, environment variables, and config files.
What is a Dockerfile?
A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image.
How do you create a Docker container?
By using the docker run command along with various options and an image name.
What is Docker Hub?
Docker Hub is a cloud-based registry service that allows you to link to code repositories, build your images, test them, store manually pushed images, and link to Docker Cloud.
How do you stop a Docker container?
Use docker stop <container_id> to gracefully stop a container. You can also use docker kill <container_id> for a forceful stop.</container_id></container_id>
Explain the role of the docker ps command.
The docker ps command is used to list the running containers.
How do you list all Docker containers?
Use docker ps -a to list all containers, including the ones that are stopped.
What are Docker network drivers?
Network drivers provide the networking capabilities for containers. Common types include bridge, host, overlay, macvlan, and none.
Explain Docker bridge network.
The default network driver for Docker. When you run a container with the docker run command, it automatically connects to this network.
How do you create a Docker network?
Use docker network create followed by options and the network name.
Can Docker containers communicate with each other by default?
Containers on the same network can communicate with each other. Containers on different networks need explicit port mapping.
What is port mapping in Docker?
Port mapping is the process of mapping a port on the host to a port in the container to allow external access to the container.
What are Docker volumes?
Docker volumes are the preferred way of handling persistent data created by and used by Docker containers.
How do you create a Docker volume?
Use docker volume create <volume_name>.</volume_name>
Explain bind mounts in Docker.
Bind mounts are a type of mount that allows you to store container data on the host system.
What is the difference between a Docker volume and a bind mount?
Docker volumes are managed by Docker and are isolated from the core functionality of the host machine, whereas bind mounts may depend on the directory structure and OS of the host machine.
How do you backup a Docker volume?
By creating a backup container that mounts the volume and then using docker cp to copy the volume to a backup location.
What is Docker Compose?
Docker Compose is a tool for defining and running multi-container Docker applications.
How do you define services in Docker Compose?
Services are defined in a docker-compose.yml file where you can specify multiple containers and their configurations.
What is the purpose of a Docker Swarm?
Docker Swarm is a clustering and scheduling tool for Docker containers. It turns a pool of Docker hosts into a single, virtual host.
https://docs.docker.com/engine/swarm/how-swarm-mode-works/nodes/
How do you scale services in Docker?
In Docker Swarm, you can scale services using the docker service scale command. In Docker Compose, use docker-compose up –scale command.