Docker failed to register layer mongo

Viewed 373

I'm using Ubuntu 20.04.1 LTS. Docker version 19.03.12, build 48a66213fe.

I was trying to pull mongo image with docker pull mongo when I got this error:

failed to register layer: Error processing tar file(exit status 1): open /var/lib/dpkg/info/gcc-8-base:amd64.list: invalid argument

I've already uninstalled docker and installed again.
I have gcc version 9 and 8 installed. I tried to uninstall gcc 9 and leave only 8 on the system, but I keep getting error.
I thought the problem was because the file he mentions in the error was missing, but I went to its folder and the file is there.

Error file folder

My terminal:

theneverchosen@TheNeverChosen:~$ docker pull mongo
Using default tag: latest
latest: Pulling from library/mongo
f08d8e2a3ba1: Extracting   26.7MB/26.7MB
3baa9cb2483b: Download complete 
94e5ff4c0b15: Download complete 
1860925334f9: Download complete 
9d42806c06e6: Download complete 
31a9fd218257: Download complete 
5bd6e3f73ab9: Download complete 
f6ae7a64936b: Download complete 
80fde2cb25c5: Download complete 
1bec62fe62fc: Download complete 
2cf4970a1653: Download complete 
39fac3226e16: Download complete 
86bca9c64faf: Download complete 
failed to register layer: Error processing tar file(exit status 1): open /var/lib/dpkg/info/gcc-8-base:amd64.list: invalid argument

theneverchosen@TheNeverChosen:~$ docker --version
Docker version 19.03.12, build 48a66213fe

theneverchosen@TheNeverChosen:~$ gcc --version
gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

theneverchosen@TheNeverChosen:~$ gcc-8 --version
gcc-8 (Ubuntu 8.4.0-3ubuntu2) 8.4.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2 Answers

I solved this problem reading this info:

https://docs.docker.com/engine/security/rootless/#docker-pull-errors

I figured it out reading this link:

https://docs.oracle.com/cd/E37670_01/E75728/html/ol-docker-userns-remap.html

And increasing those value contained in those files (/etc/subuid and /etc/subgid) and reboot (not mentioned) as this link recommended:

https://ubuntu.com/blog/custom-user-mappings-in-lxd-containers

The only thing that I noticed is that my path to the storage disk was renamed from "DATA" to "DATA1" and I don't know why this happened. DATA is innaccesible from terminal with the typical "permission denied" message and from GUI file browser it appeared as always "DATA". But hey, I finally was able to pull the image that I wanted and I can continue with my life happily ever after. :D!

For future reference:
The problem was not specific to mongo, if you get an error that says Error processing tar file this might help you.

Cause:
In this case there was a broken layer of the mongo image that caused the unpacking to fail.

Fix:
Delete the layer of the image manually. If you do not know which layer it is or how to do it, do the following:

  • You need to rebuild/pull all images afterwards and all containers, volumes etc. will be gone. Make sure you take backups in case something valuable is in there.
  • Uninstall docker
  • Remove /var/lib/docker (If you store your docker stuff in a different place, you need to clean up that.)
  • Reinstall docker
Related