Anyone have an idea what I'm doing wrong here?

gist.github.com/pganssle/31a89

I can't seem to get a minimal docker-compose configuration to expose nginx outside of the container.

(Note, replace _ with / in the file names of the gist).

@pganssle should you mv config_nginx_nginx.conf down into ./config/nginx ?

I saw this error:
nginx_1 | nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)

Follow

@edsu It's supposed to be config/nginx/nginx.conf, gist doesn't support directories.

@pganssle does it help if you remove this from the docker-compose.yml?

command: "nginx"

This adapted version seems to be working for me?

github.com/edsu/nginx-docker-c

@pganssle

Do you know why that worked?

When the daemon is on then the call to nginx command returns immediately and it spawns in the background. This was causing your container to exit when nginx returned.

So the reason your curl statement wasnt working was because your container wasnt running when you tried it.

The stuff i was saying about binding to localhost is generally still true, but it appears you were correctly binding nginx to the wildcard IP and not exclusive to localhost. Keep this in mind for your future debugging so you dont use localhost in the future when debugging inside the container (which wasnt helpful)

@edsu

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.