In Docker Compose, what is the primary function of environment variables?
To specify the build context for a service's Dockerfile
To define the Docker image to be used for a service
To pass dynamic configuration values to services at runtime
To configure the network settings for services
When might a bind mount be a suitable choice for data persistence in Docker?
When you want to leverage the scalability and redundancy of cloud storage.
When you need to share sensitive configuration files between the host and a container.
When you need to share data between multiple Docker containers running on the same host.
When you require data portability across different Docker environments.
How do you stop a running Docker container named 'mycontainer'?
docker halt mycontainer
docker stop mycontainer
docker down mycontainer
docker kill mycontainer
Which of the following is NOT a valid health check type in a Dockerfile?
TCP
CMD
NONE
HTTP
Which statement accurately describes a drawback of using bind mounts for sensitive data?
Bind mounts are not supported in the latest versions of Docker.
Bind mounts can expose parts of the host's filesystem to containers, potentially leading to security risks.
Bind mounts are less efficient than Docker volumes for handling large data volumes.
Bind mounts provide enhanced security for storing sensitive data.
How can you invalidate the Docker build cache for a specific instruction?
By using the --no-cache flag during the build process.
--no-cache
By modifying the instruction itself.
All of the above.
By deleting the corresponding image layer.
What is the purpose of 'docker exec' command?
To push a Docker image to a registry
To build a Docker image from a Dockerfile
To execute a command inside a running container
To list all available Docker images
How does Docker integrate with GitLab CI for automated testing?
GitLab CI can use Docker images to provide isolated environments for running tests
GitLab CI automatically generates Dockerfiles based on project code
Docker replaces the need for a separate testing framework
Docker directly executes test suites within the GitLab CI/CD platform
You've scaled a service in Docker Compose, but now want to revert to a single instance. How do you achieve this?
Execute docker-compose restart <service_name>
docker-compose restart <service_name>
Utilize docker-compose scale <service_name>=1
docker-compose scale <service_name>=1
Docker Compose automatically handles this, no manual intervention needed
Use docker-compose down followed by docker-compose up
docker-compose down
docker-compose up
How can Docker be utilized to speed up the build process in a CI/CD pipeline?
By directly deploying code changes to production without testing
By caching frequently used dependencies within Docker images
By automatically scaling the number of build servers based on load
By replacing the need for unit tests in the development process