Change default docker location

Hi everyone,

I would like to request the help for changing default docker image storage location.

My Jetson Xavier NX (developer kit) is refreshed by Nvidia SDK manager with Jetpack 5.1, and it was all good. Due to the storage limitation and 11.8GB required for NGC L4T pytorch image, I want to change the default docker location to a USB drive. I checked online saying that docker cannot be run in FAT and NTFS file systems, so I tried ext4 and ext3 on my USB drive. I follow the following steps to change the default location. However, the docker would not be active after this.

sudo cp -a /var/lib/docker /mnt/usb_kingston_ext4_64gb/
sudo vim /usr/lib/systemd/system/docker.service
Adding --graph /mnt/usb_kingston_ext4_64gb/docker after ExecStart
ExecStart=/usr/bin/dockerd --graph /mnt/usb_kingston_ext4_64gb/docker -H fd:// --containerd=/run/containerd/containerd.sock

sudo vim /etc/docker/daemon.json
Adding “data-root”, “data-root”: /mnt/usb_kingston_ext4_64gb

sudo systemctl daemon-reload
sudo systemctl restart docker

The last command gives me following errors:
Job for docker.service failed because the control process exited with error code.
See “systemctl status docker.service” and “journalctl -xe” for details.

And I checked systemctl status docker.service, and received following:
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset>
Active: failed (Result: exit-code) since Wed 2023-04-05 08:26:58 EDT; 2s a>
TriggeredBy: ● docker.socket
Process: 2791 ExecStart=/usr/bin/dockerd --graph /mnt/usb_kingston_ext3_64g>
Main PID: 2791 (code=exited, status=1/FAILURE)

Apr 05 08:26:58 ubuntu systemd[1]: docker.service: Scheduled restart job, resta>
Apr 05 08:26:58 ubuntu systemd[1]: Stopped Docker Application Container Engine.
Apr 05 08:26:58 ubuntu systemd[1]: docker.service: Start request repeated too q>
Apr 05 08:26:58 ubuntu systemd[1]: docker.service: Failed with result 'exit-cod>
Apr 05 08:26:58 ubuntu systemd[1]: Failed to start Docker Application Container>

Please let me know if you have any thoughts and suggestions. Thank you very much.

Yilin Wang


You can try to create a soft link to do the trick.

1. Stop docker

$ service docker stop

2. Move the docker data

$ mv /var/lib/docker /<new location>/docker

3. Create a soft link

$ ln -s /<new location>/docker /var/lib/docker

4. Restart the docker

$ service docker start


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.