0

My dockerfile is very simple:

FROM scratch
ADD archlinux-bootstrap-2020.06.01-x86_64.tar.gz /

however, it still fails:

Sending build context to Docker daemon  166.3MB
Step 1/2 : FROM scratch
 --->
Step 2/2 : ADD archlinux-bootstrap-2020.06.01-x86_64.tar.gz /
ApplyLayer exit status 1 stdout:  stderr: Container ID 100011 cannot be mapped to a host ID

I've checked the archive, everything is owned just by root. I have userns set up with xx:100000:65536. It seems to work fine for docker run, the process is run under user 100000. But the build fails and I'm not sure why.

I'm not even sure why it tries the 100011, everything in the archive is owned by 0, so it should use just 100000 (if I understand how this is supposed to work).

EDIT:

Minimal reproduction can:

:$ curl -fLo archlinux-bootstrap-2020.06.01-x86_64.tar.gz https://ftp.sh.cvut.cz/arch/iso/2020.06.01/archlinux-bootstrap-2020.06.01-x86_64.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  158M  100  158M    0     0  22.0M      0  0:00:07  0:00:07 --:--:-- 22.8M
+$ echo 'FROM scratch' >Dockerfile
+$ echo 'ADD archlinux-bootstrap-2020.06.01-x86_64.tar.gz /' >>Dockerfile
+$ docker build -t xx .
Sending build context to Docker daemon  166.3MB
Step 1/2 : FROM scratch
 --->
Step 2/2 : ADD archlinux-bootstrap-2020.06.01-x86_64.tar.gz /
ApplyLayer exit status 1 stdout:  stderr: Container ID 100011 cannot be mapped to a host ID
graywolf
  • 7,092
  • 7
  • 53
  • 77
  • What are the UID/GID's on the files inside the tar.gz file? – BMitch Jun 14 '20 at 23:59
  • What's in your `/etc/subuid`? – Joseph Sible-Reinstate Monica Jun 15 '20 at 00:01
  • @BMitch `everything in the archive is owned by 0` – graywolf Jun 15 '20 at 08:50
  • @JosephSible-ReinstateMonica just this one line `xx:100000:65536`. Docker is run with `userns-remap=xx`. – graywolf Jun 15 '20 at 08:51
  • What version of docker, and have you enabled buildkit? – BMitch Jun 15 '20 at 09:43
  • @BMitch 19.03.11-ce and I don't think so, I definitely did not do it manually so assuming it is off by default it should be off (tbh I'm not sure what buildkit even is). – graywolf Jun 15 '20 at 10:11
  • Are you able to provide a [mcve], e.g. with a tar.gz file and Dockerfile pushed up to a git gist? – BMitch Jun 15 '20 at 12:53
  • This is enough to reproduce it on my machine: https://paste.vpsfree.cz/FfPFuFPp/raw/ – graywolf Jun 15 '20 at 13:52
  • Sorry for the lag, without the tag only the question owner gets the notification. I tried this in my environment and couldn't reproduce the error, with and without buildkit. Also with 19.03.11. This is on Debian 10 and similar options. Please include your full userns-remap, subuid, and subgid configuration in your question. – BMitch Jun 16 '20 at 14:15

0 Answers0