diff --git a/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
index 52b2b38061f3..e861164920fa 100644
--- a/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
+++ b/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
@@ -109,6 +109,14 @@
writers.writePyPy2 needs to be used.
+
+
+ If you previously used
+ /etc/docker/daemon.json, you need to
+ incorporate the changes into the new option
+ virtualisation.docker.daemonConfig.
+
+
diff --git a/nixos/doc/manual/release-notes/rl-2205.section.md b/nixos/doc/manual/release-notes/rl-2205.section.md
index 27491e7837c6..17e1727dfbcb 100644
--- a/nixos/doc/manual/release-notes/rl-2205.section.md
+++ b/nixos/doc/manual/release-notes/rl-2205.section.md
@@ -41,6 +41,8 @@ In addition to numerous new and upgraded packages, this release has the followin
- The `writers.writePython2` and corresponding `writers.writePython2Bin` convenience functions to create executable Python 2 scripts in the store were removed in preparation of removal of the Python 2 interpreter.
Scripts have to be converted to Python 3 for use with `writers.writePython3` or `writers.writePyPy2` needs to be used.
+- If you previously used `/etc/docker/daemon.json`, you need to incorporate the changes into the new option `virtualisation.docker.daemonConfig`.
+
## Other Notable Changes {#sec-release-22.05-notable-changes}
- The option [services.redis.servers](#opt-services.redis.servers) was added
diff --git a/nixos/modules/virtualisation/docker.nix b/nixos/modules/virtualisation/docker.nix
index 06858e150309..80bf804cb293 100644
--- a/nixos/modules/virtualisation/docker.nix
+++ b/nixos/modules/virtualisation/docker.nix
@@ -8,7 +8,8 @@ let
cfg = config.virtualisation.docker;
proxy_env = config.networking.proxy.envVars;
-
+ daemonConfigJson = builtins.toJSON cfg.daemonConfig;
+ daemonConfigFile = pkgs.writeText "daemon.json" daemonConfigJson;
in
{
@@ -52,6 +53,20 @@ in
'';
};
+ daemonConfig =
+ mkOption {
+ type = types.anything;
+ default = { };
+ example = {
+ ipv6 = true;
+ "fixed-cidr-v6" = "fd00::/80";
+ };
+ description = ''
+ Configuration for docker daemon. The attributes are serialized to JSON used as daemon.conf.
+ See https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file
+ '';
+ };
+
enableNvidia =
mkOption {
type = types.bool;
@@ -173,6 +188,7 @@ in
${cfg.package}/bin/dockerd \
--group=docker \
--host=fd:// \
+ --config-file=${daemonConfigFile} \
--log-driver=${cfg.logDriver} \
${optionalString (cfg.storageDriver != null) "--storage-driver=${cfg.storageDriver}"} \
${optionalString cfg.liveRestore "--live-restore" } \