The Admin Guide recommends configuring dockerd using systemd directly instead of an OPTIONS variable, but it doesn’t mention daemon.json. I would imagine using daemon.json may be preferred for human readability so I ask, are there any limitations of configuring dockerd using JSON instead of systemd? Why should I choose one over the other?
You could (and arguably should, if you’re using systemd and have a large number of parameters to configure) use both.
Just point to
daemon.json in the
ExecStart line. e.g.,
ExecStart=/usr/bin/docker daemon --config-file /etc/docker/daemon.json
I notice as well that
/etc/docker/daemon.json is the default value for that flag, so even without changing the systemd unit file Docker will look for (and load) this file when systemd starts up the Docker service.