Error with adduser command when building the dockerfile
Hi,
When I try to build the Dockerfile, I have the following error:
➜ build git:(master) docker build -f Dockerfile.builder .
[+] Building 48.4s (7/7) FINISHED
=> [internal] load build definition from Dockerfile.builder 0.0s
=> => transferring dockerfile: 887B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/golang:1.16.2-stretch 1.1s
=> CACHED [1/4] FROM docker.io/library/golang:1.16.2-stretch@sha256:1bf98b13aa56635f0a69bdb9bc35cba11a672fd65f 0.0s
=> [2/4] RUN curl -sS http://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && echo "deb http://dl.yarn 39.9s
=> [3/4] RUN apt-get install -y gcc-arm-linux-gnueabihf libc6-dev-armhf-cross gcc-aarch 7.0s
=> ERROR [4/4] RUN if [ "" != "root" ]; then (adduser -q --gecos "" --home /home/ --disabled-password -u 0.3s
------
> [4/4] RUN if [ "" != "root" ]; then (adduser -q --gecos "" --home /home/ --disabled-password -u && chown -R ":" /home/); fi:
#6 0.292 adduser [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID]
#6 0.292 [--firstuid ID] [--lastuid ID] [--gecos GECOS] [--ingroup GROUP | --gid ID]
#6 0.292 [--disabled-password] [--disabled-login] [--add_extra_groups] USER
#6 0.292 Add a normal user
#6 0.292
#6 0.292 adduser --system [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID]
#6 0.292 [--gecos GECOS] [--group | --ingroup GROUP | --gid ID] [--disabled-password]
#6 0.292 [--disabled-login] [--add_extra_groups] USER
#6 0.292 Add a system user
#6 0.292
#6 0.292 adduser --group [--gid ID] GROUP
#6 0.292 addgroup [--gid ID] GROUP
#6 0.292 Add a user group
#6 0.292
#6 0.292 addgroup --system [--gid ID] GROUP
#6 0.292 Add a system group
#6 0.292
#6 0.292 adduser USER GROUP
#6 0.292 Add an existing user to an existing group
#6 0.292
#6 0.292 general options:
#6 0.292 --quiet | -q don't give process information to stdout
#6 0.292 --force-badname allow usernames which do not match the
#6 0.292 NAME_REGEX configuration variable
#6 0.292 --help | -h usage message
#6 0.292 --version | -v version number and copyright
#6 0.292 --conf | -c FILE use FILE as configuration file
#6 0.292
#6 0.292 Option uid requires an argument
------
executor failed running [/bin/sh -c if [ "${HOST_USER}" != "root" ]; then (adduser -q --gecos "" --home /home/${HOST_USER} --disabled-password -u ${HOST_UID} ${HOST_USER} && chown -R "${HOST_UID}:${HOST_UID}" /home/${HOST_USER}); fi]: exit code: 1
To Reproduce
-
cd build -
docker build -f Dockerfile.builder .
Desktop :
- OS: MacOS 11.4
- Docker 20.10.7
Hi, thanks for reporting this issue. Would it be possible for you to try to build the container by running the Makefile?
To do this just cd to the project root and run make container. I suspect the error you experienced is due to undefined build arguments HOST_UID and HOST_USER. If your test is successful, I will update the Dockerfile with sane defaults for these two variables.
Already tried, but I got the following error due to MacOS:
make[2]: *** No rule to make target `darwin_amd64'. Stop.
make[1]: *** [dev] Error 2
make: *** [container] Error 2
I will try to edit the dockerfile to not use variable
Ok, that makes sense. Thanks for reporting back. We will fix the Dockerfiles in the next release. If you come across any other issue, please let us know.
Without variable, it's working.
But I can't compile, so I can't copy the binaries when running the second "docker build".