Complete the code to specify the version of the docker-compose file.
version: '[1]'
The version field in docker-compose.yml specifies the file format version. '3.8' is a common and valid version string.
Complete the code to define the services section in docker-compose.yml.
services:
[1]:The services section lists service names. 'web' is a typical service name example.
Fix the error in the service definition to specify the image to use.
services:
app:
image: [1]The image field requires the image name and tag separated by a colon, like 'myapp:latest'.
Fill both blanks to define ports mapping and restart policy.
services:
db:
ports:
- '[1]:5432'
restart: [2]The port mapping maps host port 5433 to container port 5432. The restart policy 'always' restarts the container automatically.
Fill all three blanks to define environment variables, volumes, and command for a service.
services:
redis:
environment:
- REDIS_PASSWORD=[1]
volumes:
- [2]:/data
command: [3]Environment variable sets the password. Volume maps local './redisdata' to container '/data'. Command runs redis-server with password.