I have a Dockerfile and custom nginx configuration file (in the same directory with Dockerfile) as follows:
Dockerfile:
FROM nginx COPY nginx.conf /
An example for adding gzip config:
docker run -v [./]gzip.conf:/etc/nginx/conf.d/gzip.conf nginx
or docker-compose:
version: '3' services: nginx: image: nginx volumes: - ./gzip.conf:/etc/nginx/conf.d/gzip.conf - ./html:/usr/share/nginx/html:ro