Development: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
Software versions:
- Docker Compose version v2.5.1
- Docker version 20.10.14, build a224086
- M1 Pro on macOS Monterey version 12.4
Environment variables
- APP_ENV=development
- DOCKER_ACCT=codewithdan
Steps Taken from comments on docker-compose.yml
- Update config values (localhost --> mongo and localhost --> redis) in config/config.development.json if necessary.
-> Did not edit
- Set APP_ENV environment variable by running the following command in your commnand window export APP_ENV=development or export APP_ENV=production export DOCKER_ACCT=codewithdan
-> Done
- Remove "node" service
volume(below) if doing a production build
-> Did not remove, using development mode
- Run docker-compose build
-> Done
- Run docker-compose up
-> Done
Screenshots:
nginx:

Logs
Running docker logs nginx:
2022/05/31 01:25:15 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:25:15 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:25:16 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:25:16 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:25:17 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:25:19 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:25:23 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:25:29 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:25:43 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:26:08 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:27:00 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:28:00 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:29:01 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:30:01 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:31:01 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:32:02 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:33:02 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:34:02 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:35:02 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:36:03 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:37:03 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:38:03 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:39:04 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:40:04 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:41:04 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 2022/05/31 01:42:05 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28 nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
Please help, I'm doing my best to learn docker,
Thanks in advance @DanWahlin
Hi @edchelstephens. Thanks for providing the details - very helpful.
It looks like your Node service/container didn't start up correctly based on the nginx error. If you're using "development" for the environment variable (you mention that above), the docker-compose.yml file needs to have the volume definition in the .yml file since a volume is used when in development mode. You'd also need to run npm install locally as well. I'd recommend going back through the steps to make sure every step was completed. I just tried it out again and things seems to be working correctly.
If you set APP_ENV=production then you'd take the volume definition out of the .yml file since at that point it'll do the npm install during the Docker image creation process.
I got it working, huge thanks!
I followed your instruction, ran npm install
and then re-did the same steps for development I mentioned above.
Thank you @DanWahlin! :)