Question

Docker compose - (nginx, node.js, react)

Hi, I have some troubles with my application I am using docker-compose and I have 2 backend node.js apps and 1 react fe. Part of docker-compose is nginx. After start everything works fine, but in a while (sometimes hours, sometimes minutes) ngnix starts to return error - “*426 upstream timed out (110: Connection timed out) while reading response header from upstream” The weird part is that on other Droplet everything works fine

upstream fe-wpos {
  server fe-wpos:3000;
}

upstream be-wpos {
  server be-wpos:5000;
}

upstream be-rs-wpos {
  server be-rs-wpos:8081;
}

server {
  listen 80;
  location / {
    proxy_pass http://fe-wpos;
  }
}

server {
  listen 5000;
  location / {
    proxy_pass http://be-wpos;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }
}

server {
  listen 8081;
  location / {
    proxy_pass http://be-rs-wpos;
  }
}

I have no idea what is wrong


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Hi there,

As the services are working for some time before you get the error, this makes me think that the problem is not related to your docker-compose YAML.

Most likely one of the services is crashing due to an error or due to not enough memory on the server for example.

I would recommend, checking your Docker container logs for some more information.

You could find the logs for a specific container with the following:

  • First get your container ID:
docker ps -a
  • Then once you have the ID check the logs:
docker logs -f container_id

In there you should be able to see any application errors that pop up. If you don’t see any logs, you might have to enable debug mode and try again.

Let me know how it goes! Best, Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel