Complete the code to specify the version of Docker Compose file format.
version: '[1]' services: app: image: myapp:latest
The version '3.8' is a widely used and stable Docker Compose file format version suitable for development environments.
Complete the code to expose port 8000 on the host machine.
services:
web:
image: mywebapp
ports:
- '[1]:8000'Mapping port 8000 on the host to port 8000 in the container allows access to the app on localhost:8000.
Fix the error in the volume mount to map the current directory to /app inside the container.
services:
backend:
image: backend:dev
volumes:
- '[1]:/app'Using './' correctly maps the current directory to /app in the container, which is common in dev setups.
Fill both blanks to set environment variables for the service.
services:
db:
image: postgres
environment:
- [1]=devuser
- [2]=devpassPostgres expects environment variables POSTGRES_USER and POSTGRES_PASSWORD to set up the database user and password.
Fill all three blanks to define a service with build context, restart policy, and command override.
services:
api:
build: [1]
restart: [2]
command: [3]The build context './api' points to the Dockerfile location. Restart policy 'always' keeps the container running. The command overrides the default to run the app.