C
C#5mo ago
whgrs1692

Unable to connect to containerised postgres from webapi container ( on Ubuntu)

I have a docker compose ( webapi + postgres) that runs correctly. However, when I try and run dotnet ef database update, it throws a Socket Error: dotnet ef database update Build started... Build succeeded. System.Net.Sockets.SocketException (00000001, 11): Resource temporarily unavailable So, I docker exec into the webapi container ( which has a psql client) and I create a connection to the postgres container. The connection is established no problem. This proves the containers can communicate. So what is going on when the dotnet ef command runs? Cant really post it on ef github cause they will just throw it out. Where to next?
3 Replies
blueberriesiftheywerecats
show connection string
whgrs1692
whgrs1692OP5mo ago
The connection string from where? The docker file or the appsettings? "Host=db;Database=fsbo_db;Username=fsbo_user;Password=fsbo_password;" That connection string is exactly the same in the docker compose file
Cracker
Cracker5mo ago
hostnames and IPs are different in containers, are they in same network ? You have successful connection from api to postgres both witin container right ? If they are not in same network, you can configure your compose file like following, check the network sections. https://github.com/atakanertrk/utility-nest/blob/main/TaskNotify/backend-api-docker-compose.yml
Want results from more Discord servers?
Add your server