Rootless docker pull stops with lchown: invalid argument
Your error
docker: failed to register layer: Error processing tar file(exit status 1): lchown <FILE>: invalid argument3 more lines it can showFix it fast
Most common cause, 1 of 3Your user has no subordinate ID range, or one that is too short
Give the account one block of 65,536 IDs in both files with usermod.
sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 "$(whoami)"
systemctl --user restart docker.serviceShort answer
failed to register layer ... lchown <file>: invalid argument appears when rootless Docker cannot map a file owner from the image, because /etc/subuid or /etc/subgid gives your user too few subordinate IDs. Add a range of at least 65,536 (wider if the error names a higher UID) and restart the user daemon. Docker Engine 29 rootless mode.
Which cause do you have?
Confirm which daemon you talk to and read your subordinate ID lines. A rootless daemon lists rootless under Security Options. The last number on your line in /etc/subuid and in /etc/subgid is how many IDs your user owns.
docker info | grep -iE "rootless|Docker Root Dir"
grep "^$(whoami):" /etc/subuid /etc/subgidThen find the line you see in this list and open its fix:
- 1Your user has no subordinate ID range, or one that is too short
grep prints nothing for one of the two files, or the count at the end of the line is well under 65536 - 2The image owns files with a UID larger than your range
Your range is already 65536, and the newer message names the file with a large number after for UID - 3The rootless data directory sits on NFS
The message ends in operation not permitted rather than invalid argument, and the home folder is a network mount
What does the error look like?
docker: failed to register layer: Error processing tar file(exit status 1): lchown <FILE>: invalid argumentfailed to register layer: ApplyLayer exit status 1 stdout: stderr: lchown /usr/local/bin/docker-credential-gcr: invalid argumentfailed to Lchown "<path>" for UID <uid>, GID <gid>: lchown <path>: invalid argument (Hint: try increasing the number of subordinate IDs in /etc/subuid and /etc/subgid)docker: failed to register layer: ApplyLayer exit status 1 stdout: stderr: lchown <FILE>: operation not permitted
Cause 1 of 3
Your user has no subordinate ID range, or one that is too short
You seegrep prints nothing for one of the two files, or the count at the end of the line is well under 65536
Check
A rootless pull that ends in lchown ... invalid argument means the kernel had no host ID for a file owner in the layer, since /etc/subuid or /etc/subgid lists too few entries for your login. Docker's rootless prerequisites ask for at least 65,536 subordinate IDs in both files.
grep "^$(whoami):" /etc/subuid /etc/subgidFix
Give the account one block of 65,536 IDs in both files with usermod. Choose a start number that no other line in either file already covers. Then restart the user's Docker service so the daemon starts again with the new ranges.
sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 "$(whoami)"
systemctl --user restart docker.serviceVerify
Both files now show a line for your user ending in 65536, and the pull that failed runs to the end.
docker pull <image-that-failed>Confirmed by docs.docker.com
Cause 2 of 3
The image owns files with a UID larger than your range
You seeYour range is already 65536, and the newer message names the file with a large number after for UID
Check
Docker notes that the number of IDs an image needs varies, and 65,536 covers most images but not every one. In rootless mode a container UID n is placed at subuid + (n - 1) on the host, so an owner number above your count has nowhere to land.
docker pull <image-that-failed> 2>&1 | grep -o 'for UID [0-9]*, GID [0-9]*'Fix
Swap the old block for a wider one whose size is larger than the UID in the error, again without overlapping any other line. With both delete and add flags, usermod removes the old ranges before it adds the new one.
sudo usermod --del-subuids 100000-165535 --del-subgids 100000-165535 \
--add-subuids 100000-1199999 --add-subgids 100000-1199999 "$(whoami)"
systemctl --user restart docker.serviceVerify
grep shows the larger count, and the pull gets past the file that was named.
grep "^$(whoami):" /etc/subuid /etc/subgid && docker pull <image-that-failed>Confirmed by docs.docker.com
Cause 3 of 3
The rootless data directory sits on NFS
You seeThe message ends in operation not permitted rather than invalid argument, and the home folder is a network mount
Check
Docker's troubleshooting page ties lchown ... operation not permitted mostly to ~/.local/share/docker living on NFS, where the server refuses the ownership change. More subordinate IDs do not help there.
findmnt -T ~/.local/share/docker -o TARGET,FSTYPEFix
Point the rootless daemon at a local disk. Set data-root in the daemon.json under your own config folder, using a directory on local storage that your user owns, then restart the service.
mkdir -p ~/.config/docker
echo '{"data-root":"/local/disk/docker-data"}' > ~/.config/docker/daemon.json
systemctl --user restart docker.serviceVerify
docker info reports the local path as Docker Root Dir and the pull completes.
docker info | grep "Docker Root Dir"Confirmed by docs.docker.com
How do I stop it coming back?
- Add subuid and subgid lines in the same provisioning step that creates the account that will run rootless Docker.
- Set up each new host with dockerd-rootless-setuptool.sh install, which shows help when a prerequisite such as the ID ranges or newuidmap is missing.
- Keep ~/.local/share/docker on a local filesystem when home folders are mounted over the network.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine on the same stack: TaxiDex, Dispatch Pro.