How to assign IPv6 address with docker-compose

I am using docker 1.12.1 on Ubuntu 16.04, and docker-compose 1.8.1. I am trying to get the Compose file from to run. For reference, I created docker-compose.yml with the following content:

version: '2'

    image: busybox
    command: ifconfig
        ipv6_address: 2001:3984:3989::10

    driver: bridge
    driver_opts: "true"
      driver: default
      - subnet:
      - subnet: 2001:3984:3989::/64
        gateway: 2001:3984:3989::1

Now, running docker-compose up produces

  • Run Go app created in windows in Docker container (Ubuntu)
  • Deploy a Jekyll site from Gitlab with Gitlab CD?
  • how to connect Docker containers without a bridge?
  • Docker Ruby Rack Redis Queues
  • Run shell script inside container and delete it?
  • Monitoring MySQL running within a docker container?
  • Creating network "tmp_app_net" with driver "bridge"
    Creating tmp_app_1
    Attaching to tmp_app_1
    app_1  | eth0      Link encap:Ethernet  HWaddr 02:42:AC:10:EE:0A  
    app_1  |           inet addr:  Bcast:  Mask:
    app_1  |           inet6 addr: fe80::42:acff:fe10:ee0a/64 Scope:Link
    app_1  |           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
    app_1  |           RX packets:4 errors:0 dropped:0 overruns:0 frame:0
    app_1  |           TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
    app_1  |           collisions:0 txqueuelen:0 
    app_1  |           RX bytes:520 (520.0 B)  TX bytes:90 (90.0 B)
    app_1  | 
    app_1  | lo        Link encap:Local Loopback  
    app_1  |           inet addr:  Mask:
    app_1  |           inet6 addr: ::1/128 Scope:Host
    app_1  |           UP LOOPBACK RUNNING  MTU:65536  Metric:1
    app_1  |           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    app_1  |           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    app_1  |           collisions:0 txqueuelen:1 
    app_1  |           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    app_1  | 
    tmp_app_1 exited with code 0

    The IPv6 address is not assigned.

    I already tried:

    1. Starting the docker daemon with --ipv6
    2. Starting the docker daemon with --ipv6 --fixed-cidr-v6="2001:3984:3989::/64"
      • Note that docker run -it busybox ifconfig actually gives me an IPv6 address here (from the --fixed-cidr subnet which is assigned to the default bridge network)
    3. Using my actual IPv6 subnet instead of the one from the code example, and repeating 2. with this subnet

    No success. Any ideas?

  • Docker & Postgres: Failed to bind tcp address already in use
  • Running mysql in the foreground in centos
  • Docker and rancher
  • Docker container with build output and no source
  • Files in dir that is also a VOLUME?
  • How to install multiple packages using apt-get via a Dockerfile
  • One Solution collect form web for “How to assign IPv6 address with docker-compose”

    It turns out this is indeed a docker-compose bug that is going to be fixed in 1.9.0.

    Meanwhile, there is a workaround by creating a custom network with the docker network command:

    docker network create --subnet= --gateway= --ipv6 --subnet=<myV6Network/subnet> dockerbridge

    … which can then be made available inside docker-composed.yml by writing

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