Docker load failure: symlink "link": operation not permitted

Internal mmcblock are not large enough to load docker image.
Some moved the image to USB storage.
Docker default image path is /media/internal/docker.
USB stick is mounted at /tmp/usb/sda/sda1
Steps followed to bind these 2 paths.
root@image:~# docker rm -f $(docker ps -aq); docker rmi -f $(docker images -q)
root@image:~# systemctl stop docker
root@image:~# rm -Rf /media/internal/docker
root@image:~# mkdir /media/internal/docker
root@image:~# mkdir /tmp/usb/sda/sda1/docker/
root@image:~# mount -rbind /tmp/usb/sda/sda1/docker /media/internal/docker
root@image:~# systemctl start docker
root@image:~# ls /tmp/usb/sda/sda1/docker
builder containerd image network plugins swarm trust
buildkit containers key.json overlay2 runtimes tmp volumes
root@image:~# docker load -i /tmp/usb/sda/sda1/o20_stest2.tgz
symlink …/332cfdcee07ebaf1d06fbe96ec5fa986b19ea68501988da4aadb4d2997999f69/diff /media/internal/docker/overlay2/l/EWGVHZZ6XMJF7Z7J5RIAN26JS6: operation not permitted
root@image:~#

During load, I am facing this error.
Any help is appreciated.

Thanking you in advance.

I would strongly suggest to configure the data-root folder in /etc/docker/deamon.json (create the file if it doesn’t exist), instead of mount-binding a folder into the data-root folder of your installation.

Assuming your target folder is /tmp/usb/sda/sda1/docker, the file should look something like this:

{
    "data-root": "/tmp/usb/sda/sda1/docker"
}

If the file already existed and has content, just add the “data-root” line. Make sure to append a , at the end if you don’t paste it as last entry. Then restart the docker deamon to apply the changes.

Are you sure the filesystem of your usb drive is supported as a backing filesystem for the overlay2 storage driver? See: Docker storage drivers | Docker Documentation

1 Like

Thanks Metin for you response!

Formatting the storage device as ext4(which was fat earlier) fixed the issue.

Also, your approach to set
{
“data-root”: “/tmp/usb/sda/sda1/docker”
}
in deamon.json fixes the issue.

Regret for the delay in responding.


Sooraj