Search code examples
dockerboot2docker

Is it possible to assign a static IP address to a docker container after it's creation?


Is it possible to assign a static IP address and hostname to a docker container after it's creation ?

All my container are in the same network (bridge). The docker IP 172.17.0.x assigned by bridge network to my containers change some time after a restart of docker service and I need a static IP to save the communication between container.


Solution

  • Another idea is to associate hostname to container. IP address is not static.

    Here a simple way to use docker network to add hostname to existing container.

    [link] https://stackoverflow.com/a/41298050/6288254