Complete the Docker command to run an nginx container with a custom config file.
docker run -d -p 8080:80 -v ./mynginx.conf:/etc/nginx/nginx.conf:[1] nginx
The :ro option mounts the config file as read-only inside the container, which is a common practice for config files.
Complete the Dockerfile line to copy a custom nginx config into the image.
COPY [1] /etc/nginx/nginx.confThe source file mynginx.conf is copied into the image as the main nginx config.
Fix the error in the Docker run command to mount a directory with custom configs.
docker run -d -p 8080:80 -v [1]:/etc/nginx/conf.d nginx
The local directory ./conf.d must be relative or absolute path on the host to mount correctly.
Fill both blanks to create a Dockerfile snippet that sets the working directory and copies the config.
WORKDIR [1] COPY [2] ./
Setting /etc/nginx as working directory and copying mynginx.conf there places the config correctly.
Fill all three blanks to define a volume for nginx logs and expose port 80 in Docker Compose.
version: '3' services: web: image: nginx ports: - '[1]:80' volumes: - '[2]:/var/log/nginx' restart: [3]
Port 8080 is mapped to container port 80, volume nginx-logs stores logs, and restart policy always keeps the container running.