Reputation: 43
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
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?
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 )
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