0
0
Nginxdevops~10 mins

Volume mounting for configs in Nginx - Interactive Code Practice

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

Complete the Docker command to mount a local config file into the nginx container.

Nginx
docker run -d -p 8080:80 -v [1]:/etc/nginx/nginx.conf:ro nginx
Drag options to blanks, or click blank then click option'
A/home/user/nginx.conf
B/etc/nginx/nginx.conf
C/var/log/nginx
D/usr/share/nginx/html
Attempts:
3 left
💡 Hint
Common Mistakes
Using the container path on the left side instead of the local path.
Mounting a directory instead of the config file.
2fill in blank
medium

Complete the Docker Compose volume syntax to mount a config directory.

Nginx
volumes:
  - [1]:/etc/nginx/conf.d:ro
Drag options to blanks, or click blank then click option'
A/etc/nginx/conf.d
B/usr/share/nginx/html
C/var/log/nginx
D./config
Attempts:
3 left
💡 Hint
Common Mistakes
Using the container path on the left side.
Forgetting the ':ro' to make the mount read-only.
3fill in blank
hard

Fix the error in the Docker run command to correctly mount the config file.

Nginx
docker run -d -p 80:80 -v /home/user/nginx.conf[1] nginx
Drag options to blanks, or click blank then click option'
A:/home/user/nginx.conf
B:/etc/nginx/nginx.conf
C/home/user/nginx.conf:
D/etc/nginx/nginx.conf:
Attempts:
3 left
💡 Hint
Common Mistakes
Reversing the local and container paths.
Missing the colon separator.
4fill in blank
hard

Fill both blanks to create a Docker Compose service that mounts a config file read-only.

Nginx
services:
  nginx:
    image: nginx
    volumes:
      - [1]:[2]:ro
Drag options to blanks, or click blank then click option'
A./nginx.conf
B/etc/nginx/nginx.conf
C/var/log/nginx
D/usr/share/nginx/html
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping local and container paths.
Forgetting the ':ro' suffix.
5fill in blank
hard

Fill all three blanks to define a Docker Compose volume mount for a config directory with read-only access.

Nginx
services:
  webserver:
    image: nginx
    volumes:
      - [1]:[2]:[3]
Drag options to blanks, or click blank then click option'
A./config
B/etc/nginx/conf.d
Cro
Drw
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'rw' instead of 'ro' when read-only is required.
Swapping local and container paths.