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 !

  • How to update modifications after a page reload on Docker?
  • creating a docker image with the same name
  • How many docker containers can i run simultaneously on single host?
  • Where is the Docker daemon log on Ubuntu 14.04?
  • Jenkins - Dockerfile build upon another dockerfile in private repo
  • google/cadvisor:latest image monitor container run error
  • Access Docker Container App from phone on local network
  • docker hub webhook for _failed_ build?
  • How to take Oracle-xe-11g backup from running Docker container
  • Pass optional arguments when running a Docker image
  • Not able to deploy ASP .net vnext application on VM on Azure using Docker
  • passing command line parameters to spring boot services inside docker container
  • 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.