Replies: 1 comment 1 reply
-
Hi 👋 I have always added the However, according to my knowledge, the two code blocks would not produce the same behavior. In the first code block, the The |
Beta Was this translation helpful? Give feedback.
-
Hi,
I've come across multiple Docker Compose samples where the main container uses
network_mode: service: db
. I think there are 2 reasons for this:to enable usage of "localhost" in connection strings, no matter where you run your codehttps://containers.dev/guide/dockerfile#docker-compose-image
However I don't quite understand why the devcontainer uses the db's network adapter rather than the other way around.
It makes more sense to me to make this work the other way around by attaching the db to the devcontainer's network adapter.
Does this work just as well, or is there a reason why you wouldn't do this?
Beta Was this translation helpful? Give feedback.
All reactions