If you have installed Docker as part of installation of Ubuntu, then Docker is installed as a snap.
The config can be found in /var/snap/docker/current/config/daemon.json
.
Refer to https://github.com/docker-archive/docker-snap/issues/22#issuecomment-423361607
Summary:
anonymouse64 commented on 21 Sep 2018
Modifying the daemon.json file is now supported in the version of the snap
I have published in the edge channel. The daemon is now hard-coded to read
the config file for it's settings, so you can now edit the daemon.json
located in $SNAP_DATA/config/daemon.json (on Ubuntu for example $SNAP_DATA
is /var/snap/docker/current, it may be different on your distribution) and
then restart docker for the changes to take effect with:
sudo snap restart docker
You may switch the snap to the edge channel to test this by running:
sudo snap refresh docker --edge
The changes in the edge channel should show up in stable in a short while
if you don't wish to use edge.
This now seems to be present in 'stable'. I am using Ubunu 20.04 and I found daemon.json
in /var/snap/docker/current/config/daemon.json
.
I changed the 'log-driver' to 'local' and this was picked up by docker after restarting it:
docker info --format '{{.LoggingDriver}}'
json-file
nano /var/snap/docker/current/config/daemon.json
# added line: "log-driver":"local",
snap restart docker
docker info --format '{{.LoggingDriver}}'
local