Is it possible to assign a static public ip to a Docker Container?

I have been trying to assign one of my five public ip’s to my docker container. It seems like this should be possible because of the nature of docker and its uses. I found this website that I think explains what I want to do but it no longer works since Docker went away from LXC:

  • Docker and grunt-based workflow automation
  • salt: several minions on one host? [closed]
  • Running bvlc-caffe docker image as non-root user results in unexpected NVCC flags
  • How to make nginx-docker container running always
  • Building image on a docker container for running own Django app
  • Use Docker rather than native/homebrew on Mac?
  • I have tried making a static NAT connection with the ip that my container was using but that didn’t work. The docker IP does not show up in my routers page, only the host computers ip.

    My questions are:

    Is it possible to assign a static public ip to a docker container, and if so how?


    Is it possible to make a docker IP appear in my router config page, and if so how?


  • why different output from zabbix_get and zabbix_agentd command?
  • Exposing local Docker containers on internet (There are two containers linked to each other).
  • How do we set docker containers to restart on reboot and on-failure?
  • eclipse pdt debugger configuration with docker container for apache2, php7 and xdebug hosted on ubuntu 16.04
  • Can not pull docker images from docker-registry when using ceph storage
  • How many concurrent requests can dockerd handle?
  • 3 Solutions collect form web for “Is it possible to assign a static public ip to a Docker Container?”

    Docker 1.10 will allow you to specify a static IP-address for a container
    for each network it’s connected to.

    (Note that, for backward compatibility, this feature is only supported for custom networks, and only if a subnet is specified)

    For example;

    docker network create -d bridge --subnet mynet
    docker run -d --net=mynet --ip= nginx

    For more information see the documentation pull request

    Possible Solution but I can’t test it right now. Please let me know if this is incorrect.

    Make virtual network interface with macvlan:



    ip link add dev macvlan0 link eth0 type macvlan #macvlan0 being the name of the v-card (lol)

    Connect container to virtual network interface with pipework:



    pipework macvlan0 $($containerid) dhcp

    The only way I know of to have a docker container use a static ip is using pipework.

    Assuming you mean acquiring a DHCP lease and showing up on your router page — Nothing comes to mind with docker. I don’t think that is “the docker way”. It’s pretty simple with nspawn if you are using a systemd based distro, FWIW.

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