In a Docker Compose setup, how can you link a service to another service's network without directly exposing its ports to the host?
By using the expose keyword in the dependent service's configuration and listing the target service's ports
expose
By defining both services under the same custom network within the networks section
networks
It is not possible to achieve this; services must have ports exposed to the host for communication
By using the depends_on keyword and specifying the target service
depends_on
What is the role of a Docker registry in a CI/CD pipeline?
To monitor application performance in real-time
To execute automated tests within isolated containers
To store and manage Docker images
To define the steps of the continuous integration process
What is the primary advantage of using Docker volumes over bind mounts for data persistence?
Volumes are managed by Docker and provide data portability across different host environments.
Bind mounts are easier to back up and restore compared to Docker volumes.
Volumes offer better performance compared to bind mounts.
Bind mounts are generally more secure than Docker volumes.
What is the purpose of 'docker exec' command?
To execute a command inside a running container
To build a Docker image from a Dockerfile
To list all available Docker images
To push a Docker image to a registry
What is the role of authentication tokens in the context of a Docker Registry?
They define the network routes for communication between the registry and clients.
They are used to encrypt images stored in the registry.
They provide temporary access credentials for interacting with the registry.
They are used to digitally sign images to ensure their integrity.
When choosing a data persistence strategy in Docker, which factor should be considered carefully?
The color scheme of the Docker logo.
The sensitivity and importance of the data being stored.
The version of Docker being used.
The number of containers running on the host.
How can you view the logs of a specific container named 'webserver'?
docker show-logs webserver
docker inspect webserver | grep logs
docker logs -id webserver
docker logs webserver
What is the purpose of the ONBUILD instruction in a Dockerfile?
ONBUILD
To define commands that will be executed when the container starts.
To specify the base image for the Dockerfile.
To define commands that will be executed when a new image is built FROM the current image.
To specify environment variables that will be available at build time.
What is the purpose of the COPY --from instruction in a multi-stage Docker build?
COPY --from
To copy files from the current build stage to a later build stage.
To copy files from a previous build stage to the current build stage.
To copy files from the host machine to the current build stage.
To copy files from a remote repository to the current build stage.
What role does a manager node play in a Docker Swarm cluster?
Stores and distributes Docker images to worker nodes
Executes the actual application tasks within containers
Provides networking and load balancing for the cluster
Manages cluster state, schedules tasks, and ensures service availability