Recall & Review
beginner
What is a service in Docker Compose?
A service in Docker Compose is a container configuration that defines how a container should run, including the image, ports, volumes, and environment variables.
Click to reveal answer
beginner
Which file is used to define services in Docker Compose?
Services are defined in the
docker-compose.yml file using YAML syntax.Click to reveal answer
beginner
How do you specify the image for a service in Docker Compose?
Use the
image key under the service name to specify the Docker image to use, for example: image: nginx:latest.Click to reveal answer
beginner
What is the purpose of the
ports key in a service definition?The
ports key maps container ports to host machine ports, allowing access to the service from outside the container.Click to reveal answer
beginner
How can you define environment variables for a Docker Compose service?
Use the
environment key under the service to list environment variables as key-value pairs.Click to reveal answer
Where do you define services in Docker Compose?
✗ Incorrect
Services are defined in the docker-compose.yml file using YAML syntax.
Which key specifies the Docker image for a service?
✗ Incorrect
The 'image' key specifies which Docker image the service uses.
What does the 'ports' key do in a service definition?
✗ Incorrect
The 'ports' key maps container ports to host machine ports for access.
How do you add environment variables to a service?
✗ Incorrect
The 'environment' key is used to define environment variables for a service.
Which file format is used for Docker Compose service definitions?
✗ Incorrect
Docker Compose uses YAML format in the docker-compose.yml file.
Explain how to define a simple web service in Docker Compose.
Think about the minimum keys needed to run a web server container.
You got /4 concepts.
Describe the role of environment variables in Docker Compose services and how to set them.
Consider how environment variables customize container behavior.
You got /3 concepts.