.NET Core application starts in docker container before postgres starts in another


I've tried with both ENTRYPOINT and CMD to force my ASP.NET core application to wait for my postgres container to start up the database, but I'm still met with this exception when migration runs

pgsql.NpgsqlException (0x80004005): Exception while reading from stream

Here's what I tried:

CMD ["bash -c 'while !</dev/tcp/db/5432; do sleep 1; done; dotnet API.dll"]
ENTRYPOINT ["bash -c 'while !</dev/tcp/db/5432; do sleep 1; done;", "dotnet", "API.dll"]

What am I doing wrong?

asked on Stack Overflow Dec 7, 2020 by wes

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0