Eric Camescasse
Eric Camescasse

Reputation: 43

Docker is not using the configuration in /etc/docker/daemon

docker server on my machine is currently using /var/lib/docker as the root dir, which I'm trying to change to something on my home partition instead.

I stopped docker.service, configured data-root in a file located at /etc/docker/daemon.json as per the wiki's instructions, copied over my data stored in the current root dir to the new directory, then restarted docker.service. after this, running 'docker info' still shows the original directory as the doot dir.

The /etc/docker/daemon.json file looks like this:

{ "data-root": "/home/(username)/.docker-root/docker" }

Is it an issue with permissions due to the new directory being in an user as opposed to a dedicated partition?

Upvotes: 0

Views: 306

Answers (1)

Kade Youn
Kade Youn

Reputation: 71

If your /etc/docker/daemon.json is properly located, and all spec in /etc/docker/daemon.json is correctly written,

Why don't you check the docker service logs and service file?

  1. check log
sudo journalctl -u docker.service

sudo journalctl -u docker.service | grep -i "error"
sudo journalctl -u docker.service | grep -i "warning"

get some hint from error log ( there can be some logs about your daemon settings )

  1. inspect the systmed/docker.service
sudo nano(vim,cat) /usr/lib/systemd/system/docker.service

At the docker service file, check about any options are overriding 'data-root` settings

[Service]
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

And also use daemon-reload to apply your changes to docker service

sudo systemctl daemon-reload
sudo systemctl restart docker

Upvotes: 1

Related Questions