Nginx docker setup problem

I’m following this tutorial.

It specifies that the config folder for the container should NOT exist beforehand. And I just did this:

version: '3'

services:
reverse:
  container_name: reverse
  hostname: reverse
  image: nginx
  ports:
    - 80:80
    - 443:443
  volumes:
    - ./cfg:/etc/nginx
    - *folder with certificates here*:/etc/ssl/private

This was my console output when making the directory with the docker-compose file

neuromancer@raspberrypi:~/compose $ mkdir nginx
neuromancer@raspberrypi:~/compose $ cd nginx
neuromancer@raspberrypi:~/compose/nginx $ ls
neuromancer@raspberrypi:~/compose/nginx $ nano docker-compose.yaml
neuromancer@raspberrypi:~/compose/nginx $ docker-compose up -d
Creating network "nginx_default" with the default driver
Pulling reverse (nginx:)...
latest: Pulling from library/nginx
1bc163a14ea6: Pull complete
9f9620a32f92: Pull complete
3a14710b38f2: Pull complete
b11945dd1369: Pull complete
f753bf39c726: Pull complete
921dfdc6a1c8: Pull complete
7b1d4e455094: Pull complete
Digest: sha256:b4af4f8b6470febf45dc10f564551af682a802eda1743055a7dfc8332dffa595
Status: Downloaded newer image for nginx:latest
Creating reverse ... done
neuromancer@raspberrypi:~/compose/nginx $ ls
config  docker-compose.yaml
neuromancer@raspberrypi:~/compose/nginx $ cd config
neuromancer@raspberrypi:~/compose/nginx/config $ ls

As you can see on the last line, the config folder was empty when I opened it up, and I did not create it beforehand.

When I try to run the image I get the following errors:

neuromancer@raspberrypi:~/compose/nginx $ docker-compose up
Starting reverse ... done
Attaching to reverse
reverse    | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
reverse    | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
reverse    | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
reverse    | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist
reverse    | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
reverse    | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
reverse    | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
reverse    | /docker-entrypoint.sh: Configuration complete; ready for start up
reverse    | 2023/10/19 11:24:55 [emerg] 1#1: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
reverse    | nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
reverse exited with code 1

What on earth happened here? I just set up another container for letsencrypt and it went smooth as butter.

I’ve tried deleting the image and the folder and reattempting the process, but to no avail. Anyone got a clue?

Hi, Neuromancer! I love your username.

I’m having precisely the same issue. I also followed the LetsEncrypt tutorial and came to this Reverse Proxy tutorial, and am having trouble standing up the nginx docker image.

I also sent an email to the author of the tutorials to ask for guidance, and will let you know if he replies. :smiley:

Thanks for sharing blog

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.