Recall & Review
beginner
What is the purpose of using a custom configuration file in a Docker container running nginx?
A custom configuration file allows you to change nginx settings like server names, ports, or root directories without modifying the container image itself.
Click to reveal answer
beginner
How do you include a custom nginx config file in a Docker container?
You can mount the custom config file into the container using a volume with the -v option in docker run, for example: docker run -v /my/custom/nginx.conf:/etc/nginx/nginx.conf nginx
Click to reveal answer
beginner
What is the default location of the nginx main configuration file inside the official nginx Docker container?
The default main configuration file is located at /etc/nginx/nginx.conf inside the container.
Click to reveal answer
intermediate
Why is it better to use a volume mount for custom config instead of building a new Docker image?
Using a volume mount lets you change the config quickly without rebuilding the image. It keeps your workflow simple and flexible.
Click to reveal answer
beginner
What command would you use to start an nginx container with a custom config file located at /home/user/nginx.conf on your host?
docker run --name mynginx -v /home/user/nginx.conf:/etc/nginx/nginx.conf:ro -p 8080:80 nginx
Click to reveal answer
Where should you mount your custom nginx config file inside the container?
✗ Incorrect
The official nginx Docker image uses /etc/nginx/nginx.conf as the main config file location.
What Docker option allows you to use your own config file without rebuilding the image?
✗ Incorrect
The -v option mounts a file or directory from the host into the container, allowing custom configs.
If your custom config file has errors, what will happen when nginx starts in the container?
✗ Incorrect
nginx validates the config on start and will fail if there are syntax errors.
Which command maps port 8080 on your host to port 80 in the nginx container?
✗ Incorrect
The -p option maps host port 8080 to container port 80.
Why add ':ro' at the end of a volume mount for the config file?
✗ Incorrect
Adding ':ro' makes the mounted file read-only, preventing accidental changes.
Explain how to use a custom nginx configuration file with Docker without rebuilding the image.
Think about how Docker volumes work and where nginx expects its config.
You got /4 concepts.
Describe the benefits of using a volume mount for nginx config in Docker compared to building a new image.
Consider how changing files on the host affects the container.
You got /4 concepts.