Docker containers can't access remote database

170 Views Asked by At

My backend consists of:

  1. A NodeJS/Express app,
  2. A Redis service.

The app depends on redis, so the latter always gets started before the NodeJS app. Both containers get added to the same bridge network.

The point is, after starting both containers, the NodeJS app can't fetch data from a remote database. execing into the running container shows that ping command reports 100% packet loss, any attempts to apk add anything hang - in other words, there's no access to the network. resolv.conf shows local DNS address (127.0-something), the same as in the host server. However, the server uses resolvectl and there are no problems to access any external source.

When a copy of the deployment runs on a different server (Ubuntu 18.04), all checks from above yield the same output (100% packet loss, same resolv.conf content, etc.), but the app can access the remote database! The two differences: working backend gets deployed by Gitlab pipeline on an Ubuntu 18.04 server, not working one gets deployed manually and on an Ubuntu 21.04 server.

Can it be something with user permissions maybe? The same ports on both servers are open, the same Dockerfiles are used for building. I'm running out of ideas what might be causing the issue.

0

There are 0 best solutions below