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 the host machine to the current build stage.
To copy files from a previous build stage to the current build stage.
To copy files from a remote repository to the current build stage.
When scaling a service with Docker Compose, what happens to data stored within the container's writable layer?
Data is automatically replicated across all instances of the scaled service
Docker Compose automatically creates a shared volume for the scaled service, ensuring data consistency
Data is persisted only in the original container instance; scaled instances have their own independent data
Scaling a service with data persistence requires manual configuration of shared volumes or external data stores
What is the primary advantage of using Docker volumes over bind mounts for data persistence?
Bind mounts are generally more secure than Docker volumes.
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.
When choosing a data persistence strategy in Docker, which factor should be considered carefully?
The number of containers running on the host.
The color scheme of the Docker logo.
The version of Docker being used.
The sensitivity and importance of the data being stored.
In a Docker Compose setup, how can you link a service to another service's network without directly exposing its ports to the host?
It is not possible to achieve this; services must have ports exposed to the host for communication
By defining both services under the same custom network within the networks section
networks
By using the depends_on keyword and specifying the target service
depends_on
By using the expose keyword in the dependent service's configuration and listing the target service's ports
expose
How does Docker optimize build cache for the RUN instruction?
RUN
It does not cache the results of RUN instructions.
It caches the entire file system state after each RUN instruction.
It only caches the output of the RUN command if it has changed.
It caches the result of each individual command within a RUN instruction.
Which Dockerfile instruction is used to define a health check for a container?
CHECK
EXPOSE
HEALTHCHECK
You've scaled a service in Docker Compose, but now want to revert to a single instance. How do you achieve this?
Use docker-compose down followed by docker-compose up
docker-compose down
docker-compose up
Docker Compose automatically handles this, no manual intervention needed
Execute docker-compose restart <service_name>
docker-compose restart <service_name>
Utilize docker-compose scale <service_name>=1
docker-compose scale <service_name>=1
Which data persistence approach provides the highest level of isolation between the host system and container data?
Bind mounts.
Docker volumes.
Directly writing data to the container's filesystem.
Using a shared network drive.
What is the purpose of volume drivers in Docker?
To enable the use of remote storage or cloud-based solutions for volumes.
To improve the performance of volume operations.
To manage the lifecycle of bind mounts.
To restrict container access to specific volumes.