I have defined a nginx service in my docker compose and this service is reporting the following in the Logs:
13.03.19 22:11:08 (+0100) Restarting service ‘nginx sha256:49ee99c7b0dae66dd6692192f9f41473b32b29429ce7b80133cb91464ff6a18f’
13.03.19 22:11:08 (+0100) nginx 2019/03/13 21:11:08 [emerg] 19#19: host not found in upstream “nodered” in /etc/nginx/nginx.conf:15
13.03.19 22:11:08 (+0100) nginx nginx: [emerg] host not found in upstream “nodered” in /etc/nginx/nginx.conf:15
13.03.19 22:11:10 (+0100) Killed service ‘nginx sha256:49ee99c7b0dae66dd6692192f9f41473b32b29429ce7b80133cb91464ff6a18f’
So it seems that the host nodered
is not known in the nginx container, but this is actually the name of the other service that I have defined in the docker compose file.
So I don’t understand why it is reporting the error host not found ...
It seems a similar problem as is reported in Docker Networking - nginx: [emerg] host not found in upstream - Stack Overflow
My Host OS version = balenaOS 2.29.2+rev1 (Development)
FYI The contents of my docker-compose.yml
#networks: {}
volumes:
node-red-eq3-data: {}
services:
nodered:
build: node-red-eq3
privileged: true
restart: always
network_mode: host
ports:
- "1880:1880"
volumes:
- 'node-red-eq3-data:/data'
labels:
io.balena.features.kernel-modules: '1'
io.balena.features.firmware: '1'
io.balena.features.dbus: '1'
io.balena.features.supervisor-api: '1'
io.balena.features.balena-api: '1'
io.balena.update.strategy: download-then-kill
io.balena.update.handover-timeout: ''
nginx:
build : nginx
depends_on:
- nodered
ports:
- "80:80"
- "443:443"
restart: always
The contents of my nginx Dockerfile
:
COPY ./nginx.conf /etc/nginx/nginx.conf
and the contents of my `nginx.conf` file:
events {}
http {
server {
listen 80;
listen 443 ssl;
root /usr/share/nginx/www;
index index.html index.htm;
# redirects <device public url> to node-red-eq3
location / {
proxy_pass http://nodered:1880;
}
}
}