-
Notifications
You must be signed in to change notification settings - Fork 2k
Conversation
fdfa7ca
to
c833d5f
Compare
This is useful because it can be used in `docker-compose.yml` to make a container's external port bind to the Docker host's public IP address. See: docker/compose#2915 (comment) Signed-off-by: Marc Abramowitz <[email protected]>
c833d5f
to
9107c8a
Compare
Hmm, why did the |
test this please @msabramo This docs failure was due to a jenkins node problem - putting a comment "test this please" should re-trigger a test (and it worked for me) - this time successfully |
@SvenDowideit Oh cool! Thanks! Good to know! |
@msabramo Sorry, we are clearly not going to add another environment variable to the |
@dgageot no, we are not. And in this case, this is clearly duplication for a very specific use case. |
Sure, your call of course. What is the drawback of adding an environment variable? Maybe someone can suggest an alternative way to get a usable IP address/port pair for accessing the container from a Mac? The best I can come up with is using a combo of |
@msabramo the role of the Sorry @msabramo and thanks again for the PR. Next time, you have something you'd like to see implemented, please open a ticket, discuss about the feature and then, when everybody agree that it's a good idea to move forward, you or somebody else can open a PR. |
Ah ok thanks for the explanation. Technically I am using it in a Unfortunately this was the best idea I had for making it really easy for folks to run containers from Macs and easily be able to access them. I wonder if there is some other solution for this that I have overlooked? |
I've seen a few stackoverflow issues with this exact problem, and at least one Compose issue. I think this would be useful for developers, is there a disadvantage to provide this information in a pre-parsed form (instead of requiring a developer to parse out the IP address from the |
@dnephin |
I guess someone would need to do
in a script somewhere, which doesn't seem that unreasonable to me. |
This makes the
env
command emit a new environment variable calledDOCKER_HOST_IP
.E.g.:
This is useful because it can be used in
docker-compose.yml
to make a container's external port bind to the Docker host's public IP address.I prefer to bind to the
DOCKER_HOST_IP
rather than letting it default to0.0.0.0
, because then I get useful output fromdocker-compose port
and can do stuff like:See:
docker/compose#2915 (comment)
Cc: @sudarkoff