Docker Community Forums

Share and learn in the Docker community.

Docker connecting to localhost services

docker

(Jeremypumphrey) #1

Since Docker on Mac runs under a docker-machine, is it possible to connect to services on the localhost such as a DB on 8000? I know how to connect from docker to docker, but is docker to localhost (my Mac, not docker-machine) an option?


(Ograycode) #2

See Access host (not vm) from inside container for the hoop you have to jump through.


(Jeremypumphrey) #3

Thanks, but reading that it looks like a sketch workaround by inserting your machine IP address, which will change occasionally in my case. So nothing docker native that allows this?


(David Maze) #4

On every Docker installation I’ve used (native Linux Docker, Mac VirtualBox Docker, Mac Docker beta) you’ve had to know the host system’s IP address for this sort of thing.


(Jeremypumphrey) #5

Ok, thanks. I’m trying to write the container in a way that can run on both my machine and other Mac user’s machines, using the same container and then their local db.