What is the purpose of a replica in the context of Docker Swarm services?
A backup of a manager node to ensure high availability
A copy of a Docker image stored on a different node
A load balancer that distributes traffic across multiple containers
An instance of a container running a specific task for a service
Which command is used to list all running Docker containers?
docker run
docker ps
docker images
docker start
What is the purpose of a Swarm service's 'update_config' setting?
To scale the number of replicas for the service up or down
To automatically update the service's Docker image to the latest version
To change the environment variables for the service's containers
To configure how updates to the service are rolled out across replicas
Which statement accurately describes a drawback of using bind mounts for sensitive data?
Bind mounts provide enhanced security for storing sensitive data.
Bind mounts are less efficient than Docker volumes for handling large data volumes.
Bind mounts can expose parts of the host's filesystem to containers, potentially leading to security risks.
Bind mounts are not supported in the latest versions of Docker.
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.
How do you retrieve the IP address of a running Docker container using 'docker inspect'?
docker inspect <container_name> | find 'IP'
docker inspect <container_name> --format IP
docker inspect -f '{{.NetworkSettings.IPAddress}}' <container_name>
docker inspect <container_name> | grep IPAddress
What information does the 'docker inspect' command provide?
Real-time resource usage of a running container
A list of all environment variables in a container
Low-level information about a container, image, or network
The status (running/stopped) of a container
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
Utilize docker-compose scale <service_name>=1
docker-compose scale <service_name>=1
Execute docker-compose restart <service_name>
docker-compose restart <service_name>
When scaling a service with Docker Compose, what happens to data stored within the container's writable layer?
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
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
How can you create a custom network with specific configurations (e.g., IP range, driver) in Docker Compose?
Docker Compose does not allow custom network configurations
By specifying the network configurations within the networks section of the docker-compose.yml file
networks
docker-compose.yml
By defining the network within the services section of the docker-compose.yml file
services
By using the docker network create command separately and referencing the network in the docker-compose.yml file
docker network create