Has anyone been successful in enabling IPv6 for the Docker daemon?

Currently reading
Has anyone been successful in enabling IPv6 for the Docker daemon?

3
0
NAS
DS918+
To add IPv6 support to our Docker containers, one first needs to enable IPv6 support in the Docker daemon. More specifically for our Synology boxes, the daemon.json file is located at /var/packages/Docker/etc/dockerd.json. Which begs the question: do changes to this file persist across updates? If they don't, this could be an annoyance...

Anyway, setting "ipv6": true in the daemon.json file doesn't seem to work, the Docker service doesn't start with this option.

Has anyone been able to figure out why? How do we fix this?
 
3
0
NAS
DS918+
Well, I was using MACVLAN network for a specific container and that required to properly configure IPv6 for the whole thing. However, I've moved to host network for this container and now, as long as the host itself (the NAS) has an IPv6, it will also be associated to "network: host" containers.
 

Rusty

Moderator
NAS Support
5,854
1,726
www.blackvoid.club
NAS
DS718+, DS918+, 2x RS3614RPxs+
Router
  1. RT1900ac
  2. RT2600ac
  3. MR2200ac
Operating system
  1. macOS
Mobile operating system
  1. iOS
Well, I was using MACVLAN network for a specific container and that required to properly configure IPv6 for the whole thing. However, I've moved to host network for this container and now, as long as the host itself (the NAS) has an IPv6, it will also be associated to "network: host" containers.
So v6 is a problem for you I’m guessing? Have you tried to turn v6 off on your adapter on host level?
 
3
0
NAS
DS918+
I think you misunderstood me... I had a problem with IPv6 when I was using a MACVLAN network for a specific container, to get that network with IPv6, Docker needs to support it to (which doesn't seem currently possible). I no longer have a problem because I switched the container to "host mode".
 
1
2
NAS
DS218+, DS213j
Last edited:
Hi, found this thread on a similar case as described by 0xKubo. Changing dockerd.json in /var/packages/Docker/etc/dockerd.json resulted in error while trying to restart docker service. I figured another dockerd.json existing in /volume1/@appstore/Docker/config/dockerd.json. After both files contained the same and new settings, docker service started as usually.

Here's what I've added to the files to activate ipv6 support:
"ipv6": true,
"fixed-cidr-v6": "2001:db8:1::/64"

The second line is necessary to receive a global ipv6. Otherwise the container would receive a local fe80: address only.
Received both config lines for ipv6 from here: Walkthrough: Enabling IPv6 Functionality for Docker & Docker Compose – Collabnix

Hope that helps
 
1
0
NAS
DS220+
Operating system
  1. Windows
Mobile operating system
  1. Android
Hi, found this thread on a similar case as described by 0xKubo. Changing dockerd.json in /var/packages/Docker/etc/dockerd.json resulted in error while trying to restart docker service. I figured another dockerd.json existing in /volume1/@appstore/Docker/config/dockerd.json. After both files contained the same and new settings, docker service started as usually.

Here's what I've added to the files to activate ipv6 support:
"ipv6": true,
"fixed-cidr-v6": "2001:db8:1::/64"

The second line is necessary to receive a global ipv6. Otherwise the container would receive a local fe80: address only.
Received both config lines for ipv6 from here: Walkthrough: Enabling IPv6 Functionality for Docker & Docker Compose – Collabnix

Hope that helps
Sorry to resurrect this, but I'm hoping you can help. (I was referred to this post from Reddit.) I changed the dockerd.json file by adding the lines you have that are supposed to add to activate ipv6 support. Unfortunately, when I attempt to run Docker after changing both files I am given the message, "Failed to run the package service."

For each file below, I have bolded the part I added.
dockerd.json file in /var/packages/Docker/etc/:

"data-root" : "/var/packages/Docker/target/docker",
"log-driver" : "db",
"registry-mirrors" : [],
"storage-driver" : "btrfs"
"ipv6": true,
"fixed-cidr-v6": "2001:db8:1::/64"


dockerd.json file in /volume1/@appstore/Docker/config/:

"registry-mirrors": [],
"data-root": "/var/packages/Docker/target/docker",
"log-driver": "db"
"ipv6": true,
"fixed-cidr-v6": "2001:db8:1::/64"


If anyone can provide any advice, I would appreciate it.
 
Sorry to resurrect this, but I'm hoping you can help. (I was referred to this post from Reddit.) I changed the dockerd.json file by adding the lines you have that are supposed to add to activate ipv6 support. Unfortunately, when I attempt to run Docker after changing both files I am given the message, "Failed to run the package service."

For each file below, I have bolded the part I added.
dockerd.json file in /var/packages/Docker/etc/:

"data-root" : "/var/packages/Docker/target/docker",
"log-driver" : "db",
"registry-mirrors" : [],
"storage-driver" : "btrfs"
"ipv6": true,
"fixed-cidr-v6": "2001:db8:1::/64"


dockerd.json file in /volume1/@appstore/Docker/config/:

"registry-mirrors": [],
"data-root": "/var/packages/Docker/target/docker",
"log-driver": "db"
"ipv6": true,
"fixed-cidr-v6": "2001:db8:1::/64"


If anyone can provide any advice, I would appreciate it.
Sorry for reopening the post but I had the same issue and could resove it as follows:

You have to address the json file conformance and append a comma to each line except the last one:

dockerd.json file in /var/packages/Docker/etc/:

"data-root" : "/var/packages/Docker/target/docker",
"log-driver" : "db",
"registry-mirrors" : [],
"storage-driver" : "btrfs",
"ipv6": true,
"fixed-cidr-v6": "2001:db8:1::/64"

dockerd.json file in /volume1/@appstore/Docker/config/:

"registry-mirrors": [],
"data-root": "/var/packages/Docker/target/docker",
"log-driver": "db",
"ipv6": true,
"fixed-cidr-v6": "2001:db8:1::/64"


and the service should start as expected again.
 
3
1
NAS
DS920+
Operating system
  1. Linux
  2. macOS
  3. Windows
Mobile operating system
  1. Android
  2. iOS
Last edited:
Sorry for reopening the post but I had the same issue and could resove it as follows:

You have to address the json file conformance and append a comma to each line except the last one:

dockerd.json file in /var/packages/Docker/etc/:

"data-root" : "/var/packages/Docker/target/docker",
"log-driver" : "db",
"registry-mirrors" : [],
"storage-driver" : "btrfs",
"ipv6": true,
"fixed-cidr-v6": "2001:db8:1::/64"

dockerd.json file in /volume1/@appstore/Docker/config/:

"registry-mirrors": [],
"data-root": "/var/packages/Docker/target/docker",
"log-driver": "db",
"ipv6": true,
"fixed-cidr-v6": "2001:db8:1::/64"


and the service should start as expected again.

In my case, "ipv6": true, gets wiped from /volume1/@appconf/Docker/dockerd.json when I restart dockerd via sudo synopkgctl stop Docker && sudo synopkgctl start Docker.

"ipv6": true, is still in /volume1/@appstore/Docker/config/dockerd.json after the restart.

Has anybody experienced that?

I am on DSM 7.1-42661 Update 1.
 
Last edited:
Just to be sure, no one actualy used 2001:db8:1::/64, right?

This cidr range is a placeholder(!) for documentation purposes only, which is the sole reason why blog posts and documentation ar using this range :D

Update: Please use an Unique Local Address (ULA) within the recommended subnet fd00::/8 instead.

If you have no idea how to generate your own subnet prefix, here is an ugly looking, but helpfull ipv6 ULA subnet generator: IPv6 Local Address Range Generator. Just hit the "generate" button and use the suggested "IPv6 Network Address" instead of 2001:db8:1::/6.
 
3
1
NAS
DS920+
Operating system
  1. Linux
  2. macOS
  3. Windows
Mobile operating system
  1. Android
  2. iOS
No, no, I was using my own IPv6 range given by my ISP.

Interestingly enough the "fixed-cidr-v6": "...", section is preserved in the config but "ipv6": true, is removed.

Out of curiosity which DSM and Docker versions are you on?
 
So you got a fixed GA-Prefix from your ISP? I have dynamic GA-Prefixes and didn't bother yet to enable ivp6 for containers as per my undestanding I would still need some sort of reverse proxy to make the container accessible to the outside world. Unfortunatly full ipv6 migration is far on the buttom of my todo lit.

Regarding the dockerd.json file, may I suggest to check which one actualy is used:
Code:
[email protected]:~$ ps ax | grep dockerd
18893 ?        Ssl  279:25 /var/packages/Docker/target/usr/bin/dockerd --config-file /var/packages/Docker/etc/dockerd.json
 
2
0
NAS
DS920+
Operating system
  1. Linux
  2. macOS
Mobile operating system
  1. Android
  2. iOS
Last edited:
I have the exact same problem as @jmartin

I figured out that when the Docker package is launched, it calls this script: /var/packages/Docker/scripts/start-stop-status start
This script calls itself a binary: /var/packages/Docker/target/tool/updater
This binary is responsible to removing the "ipv6": true from /var/packages/Docker/etc/dockerd.json

I was able to prevent this to happen by commenting the line 180 of /var/packages/Docker/scripts/start-stop-status:
Code:
#        $DockerUpdaterBin postinst updatedockerdconf "$(get_install_volume_type)"

To change it easily:
Code:
sudo awk -i inplace -v INPLACE_SUFFIX=.bak 'index($1,"#"){next} index($0,"$DockerUpdaterBin postinst updatedockerdconf \"$(get_install_volume_type)\""){print "#"$0;next} {print $0}'
/var/packages/Docker/scripts/start-stop-status

Then you can use sudo synopkgctl stop Docker && sudo synopkgctl start Docker and it works ;)

Of course, this would likely need to be repeated after an upgrade of the Docker Package.
 
2
0
NAS
DS920+
Operating system
  1. Linux
  2. macOS
Mobile operating system
  1. Android
  2. iOS
Actually, here is a script you can run after each update of Docker:
Bash:
#!/bin/sh
synopkgctl stop Docker
sed -i 's/^[^#]*[[:space:]]*\$DockerUpdaterBin postinst updatedockerdconf "\$(get_install_volume_type)"/#&/' /var/packages/Docker/scripts/start-stop-status
sed -i '1a\   "ipv6" : true,' /var/packages/Docker/etc/dockerd.json
synopkgctl start Docker
It automatically adds "ipv6": true into /var/packages/Docker/etc/dockerd.json if needed, and it automatically comments the line in /var/packages/Docker/scripts/start-stop-status if needed.

Script to run with sudo.
 
3
1
NAS
DS920+
Operating system
  1. Linux
  2. macOS
  3. Windows
Mobile operating system
  1. Android
  2. iOS
Actually, here is a script you can run after each update of Docker:
Bash:
#!/bin/sh
synopkgctl stop Docker
sed -i 's/^[^#]*[[:space:]]*\$DockerUpdaterBin postinst updatedockerdconf "\$(get_install_volume_type)"/#&/' /var/packages/Docker/scripts/start-stop-status
sed -i '1a\   "ipv6" : true,' /var/packages/Docker/etc/dockerd.json
synopkgctl start Docker
It automatically adds "ipv6": true into /var/packages/Docker/etc/dockerd.json if needed, and it automatically comments the line in /var/packages/Docker/scripts/start-stop-status if needed.

Script to run with sudo.
Hi Bolemo,

I can confirm it works. The ipv6 field is not getting stripped anymore.

Here's my version using jq so the ipv6 field doesn't get added every time the script is run.

Bash:
#!/usr/bin/env bash

_main() {
  synopkgctl stop Docker

  sed -i 's/^[^#]*[[:space:]]*\$DockerUpdaterBin postinst updatedockerdconf "\$(get_install_volume_type)"/#&/' \
    /var/packages/Docker/scripts/start-stop-status


  local docker_config_path='/var/packages/Docker/etc/dockerd.json'
  local content="$(cat "${docker_config_path}")"
  jq '. | .ipv6 = true' <<< "${content}" > "${docker_config_path}"

  synopkgctl start Docker
}

_main "[email protected]"

After configuring a new docker network everything is working fine with ipv6. Thanks for your help!
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

GPU passthrough would be a great addition to VMM, even though the majority of DiskStations wouldn't...
Replies
4
Views
2,260
Thank you for your feedback on the matter. There is no need to break this into multiple topics considering...
Replies
30
Views
6,498

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Top