DokployD
Dokploy16mo ago
59 replies
Karma

During build time an application could not reach a database or api from another container.

I am migrating my projects from an older docker server to fresh dokploy server.

When i am deploying during the build time i am getting the error

#12 78.67 Raw query failed. Code: `unknown`. Message: `Kind: Server selection timeout: No available servers. Topology: { Type: Unknown, Servers: [ { Address: buscacep-db-a06dbf:27017, Type: Unknown, Error: Kind: I/O error: failed to lookup address information: Name or service not known, labels: {} } ] }, labels: {}`


This is a nextjs app trying to connect to my database. It works if i expose the port to the internet but i really don't want to do that.

On my other server i solved this problem passing the --network parameter to the build docker command so during the build time my apps could communicate with other containers on the same network without any problems.

I am also migrating another project that has a separate API/DB and an nextjs app and during the build of the nextjs app it cannot reachs the api:
#12 40.11     errno: -3008,
#12 40.11     code: 'ENOTFOUND',
#12 40.11     syscall: 'getaddrinfo',
#12 40.11     hostname: '[redacted]-api-e413a6'
#12 40.11   }
#12 40.11 }


What could be a possible solution in these cases?

Thank you
Was this page helpful?