Complete the code to specify the Nginx image in the Docker Compose service.
services:
webserver:
image: nginx[1]The image field specifies which Nginx version to use. :stable is a common tag for a reliable version.
Complete the code to map port 8080 on the host to port 80 in the Nginx container.
services:
webserver:
ports:
- "[1]:80"Port mapping syntax is host_port:container_port. Here, host port 8080 maps to container port 80.
Fix the error in the volume mapping to serve a custom Nginx config file.
services:
webserver:
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf[1]The volume mapping syntax uses a single colon : to separate host and container paths. :ro means read-only.
Fill both blanks to complete the environment variable and restart policy for the Nginx service.
services:
webserver:
environment:
- NGINX_HOST=[1]
restart: [2]NGINX_HOST is set to localhost for local testing. The restart policy always restarts the container if it stops.
Fill all three blanks to complete the Docker Compose service with build context, Dockerfile, and network.
services:
webserver:
build:
context: [1]
dockerfile: [2]
networks:
- [3]The build context is the current directory .. The Dockerfile is named Dockerfile.nginx. The service connects to the frontend network.