Frayedknot Posted July 23, 2020 Posted July 23, 2020 I know this isn't news, but it was new to me and I didn't see a post in here regarding this directly so hopefully this will help people as well. Basically when you want one docker to talk to another docker what IP do you give it. In my case I was using a Static IP because LOCALHOST doesn't work and if you have a potentially dynamic IP what do you do? I stumbled across this article https://dev.to/natterstefan/docker-tip-how-to-get-host-s-ip-address-inside-a-docker-container-5anh which let me know that in Linux you can use "172.17.0.1" to achieve this. (Windows/Mac Dockers uses "gateway.docker.internal". For some reason Linux is unique) It was really helpful for me and hopefully this was titled in such a way that others find it when they encounter the same issue. Quote
Josh.5 Posted July 23, 2020 Posted July 23, 2020 I know this isn't news, but it was new to me and I didn't see a post in here regarding this directly so hopefully this will help people as well. Basically when you want one docker to talk to another docker what IP do you give it. In my case I was using a Static IP because LOCALHOST doesn't work and if you have a potentially dynamic IP what do you do? I stumbled across this article https://dev.to/natterstefan/docker-tip-how-to-get-host-s-ip-address-inside-a-docker-container-5anh which let me know that in Linux you can use "172.17.0.1" to achieve this. (Windows/Mac Dockers uses "gateway.docker.internal". For some reason Linux is unique) It was really helpful for me and hopefully this was titled in such a way that others find it when they encounter the same issue. If the 2 containers are in the same network, then you can use the name of the containers as hostnames to communicate between them. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.