I’m trying to change the root directory of docker to an nvme ssd located at /media/user/MainVolume/
. I tried the following instructions:
- Creating and editing the
/etc/docker/daemon.json
and adding:
{
"data-root": "/media/user/MainVolume/docker/"
}
- Copying the files from
/var/lib/docker
sudo rsync /var/lib/docker/ /media/user/MainVolume/docker/
- Reload the daemon:
sudo systemctl daemon-reload
- Restart the docker service:
sudo systemctl restart docker
I got many errors when trying the rsync command saying permission denied. I don’t have any images or containers installed so I shouldn’t need to copy directories, right? After running all of the commands docker wouldn’t restart returning the following error:
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xeu docker.service" for details.
sudo systemctl status docker.service
returned:
× docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2024-08-06 06:45:31 CDT; 34s ago
TriggeredBy: × docker.socket
Docs: https://docs.docker.com
Process: 837952 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 837952 (code=exited, status=1/FAILURE)
CPU: 73ms
Aug 06 06:45:31 cherry systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Aug 06 06:45:31 cherry systemd[1]: Stopped Docker Application Container Engine.
Aug 06 06:45:31 cherry systemd[1]: docker.service: Start request repeated too quickly.
Aug 06 06:45:31 cherry systemd[1]: docker.service: Failed with result 'exit-code'.
Aug 06 06:45:31 cherry systemd[1]: Failed to start Docker Application Container Engine.
journalctl -xeu docker.service
returned:
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit docker.service has entered the 'failed' state with result 'exit-code'.
Aug 06 06:45:31 cherry systemd[1]: Failed to start Docker Application Container Engine.
░░ Subject: A start job for unit docker.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit docker.service has finished with a failure.
░░
░░ The job identifier is 9243 and the job result is failed.
Is there a different method to change the root directory or a way to fix this error?
I appreciate any help, thank you!