It’s also important to understand why that fixed your problem. The Docker container will exit when the main process terminates. Unfortunately, any process that runs as a daemon looks like it has terminated so the container exits. By using "deamon off"
you have instructed nginx to run in the foreground so that the container stays alive.
Always run the main process in the foreground when using containers.