Assigning IP address to docker containers?

I’m new to Docker. Is it possible to assign an IP address (from a DHCP server) to Docker containers running on a host or VM? If yes, can someone point me in the correct direction. If no, is it a fundamental limitation of the container approach or it’s just a feature that’s not in Docker yet.

  • How to deploy secure web application using docker on bluemix
  • Alpine Linux Docker SSHD Image Uses VOL-save?
  • How to monitor host's filesystem in a dockerized Topbeat
  • How does one detect if one is running within a docker container within Python?
  • /bin/sh: 1: python: not found while running docker container
  • How do I add big HTTP files in a Dockerfile and exclude them from image layers?
  • How does the Docker assign MAC addresses to containers?
  • How are docker-machine certs used?
  • How do I deploy to a remote docker host on windows server 2016?
  • Can't run webapplication on tomcat using Docker
  • dependency error while installing docker 1.12 in rhel 7
  • How to build a Docker image for an Arm architecture on a Mac?
  • 2 Solutions collect form web for “Assigning IP address to docker containers?”

    Caveat – Docker is under heavy development so confirming against current docs is advisable.

    The network element is one of those under current discussion on docker-dev, it looks like longer term integration with libvirt is being considered. So to answer your question NET DHCP or something is probably not implemented as you’d want.

    Some of how Docker’s networking is implemented is described in this blog post. Currently a set of IP ranges in CreateBridgeIface in network.go.

    For the meanwhile you might want to checkout pipework which is a tool designed to be used with Docker for various network configuration. This will allow you to add and modify IP addresses on your container, create private networks and connect containers to a physical interface. In the end it’s wrapping lower level tools but you might find using pipework easier.

    Docker evolved a lot during last so as for Docker 0.6.5:

    Containers have their own ip addresses now. You can check the ip address of a container using docker inspect command or if you are interested into extracting it you can use:

    docker inspect container_name | grep IPAddress | cut -d '"' -f 4.
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.