How to access boot2docker-ip from inside a docker container

I would like to obtain the boot2docker/vm that is hosting my docker containers from within the containers . I do not need the docker0’s ip, I mean the ip of the boot2docker vm itself.

thanks !

  • docker port mapping for consul agent
  • Docker: Output shown at instead of
  • Clone a repo inside a docker shared folder after being mounted
  • How to pass parameters while creating consul client agent inside a Docker container?
  • Nginx SSL inside a docker container
  • What are the pros and cons of docker pull and docker build from Dockerfile?
  • Creating docker named volume pointing to folder on host
  • Generate a random number in docker-compose file?
  • Connecting to Meteor DDP from Java with Docker container
  • Is there a performance impact to having docker containers with different OS base boxes?
  • How does Docker allow portable containers if the Kernel libraries change
  • Behat Mink file upload not finding file on submit
  • One Solution collect form web for “How to access boot2docker-ip from inside a docker container”

    I don’t know whether there is a built-in solution, but you may hand over the host’s IP address as environment variable when starting the container. Then inside the container you can access it like any other environment variable.

    So, basically this comes down to:

    $ docker run -e HOST_IP=… [the rest of the run command]

    This maybe is not the most elegant solution, but it’s simple and it works in a reliable way.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.