0
0
Nginxdevops~10 mins

Docker Compose with Nginx - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the Nginx image in the Docker Compose service.

Nginx
services:
  webserver:
    image: nginx[1]
Drag options to blanks, or click blank then click option'
A:dev
B:latest
C:alpine
D:stable
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the colon before the tag
Using a non-existent tag like ':dev'
2fill in blank
medium

Complete the code to map port 8080 on the host to port 80 in the Nginx container.

Nginx
services:
  webserver:
    ports:
      - "[1]:80"
Drag options to blanks, or click blank then click option'
A8080
B80
C8000
D443
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the ports (e.g., '80:8080')
Using a port not allowed or already in use
3fill in blank
hard

Fix the error in the volume mapping to serve a custom Nginx config file.

Nginx
services:
  webserver:
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf[1]
Drag options to blanks, or click blank then click option'
A:ro
B:rw
C::ro
D::rw
Attempts:
3 left
💡 Hint
Common Mistakes
Using double colons (::) which is invalid
Forgetting the read-only flag when needed
4fill in blank
hard

Fill both blanks to complete the environment variable and restart policy for the Nginx service.

Nginx
services:
  webserver:
    environment:
      - NGINX_HOST=[1]
    restart: [2]
Drag options to blanks, or click blank then click option'
Alocalhost
Balways
Con-failure
Dproduction
Attempts:
3 left
💡 Hint
Common Mistakes
Using invalid restart policies
Setting environment variables to wrong values
5fill in blank
hard

Fill all three blanks to complete the Docker Compose service with build context, Dockerfile, and network.

Nginx
services:
  webserver:
    build:
      context: [1]
      dockerfile: [2]
    networks:
      - [3]
Drag options to blanks, or click blank then click option'
A.
BDockerfile.nginx
Cfrontend
Dnginx
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong network names
Incorrect Dockerfile names or paths