Skip to content

Error when cloning repo in container volume using basecloj template #29

@alza-bitz

Description

@alza-bitz

Hi there, when I attempt to create a new dev container using the basecloj template in VSCode, it makes some progress but ultimately fails.

I didn't look too far into the cause but it seems like some $USERNAME script var is empty, so the groupadd command fails due to a missing argument.

I did see that ARG USERNAME=vscode is present in the Dockerfile so I don't understand how this is happening, but there you go:

[10460 ms] Start: Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-root/container-features/0.72.0-1738105208356/Dockerfile-with-features -t vsc-basecloj-93cbbf93d1175c8cf32f6dd538d1ea9f635fddfbd28782b12b9240f6d38e4c28 --target dev_containers_target_stage --build-arg BASE_IMAGE=temurin-21-tools-deps-jammy --build-arg USERNAME= --build-context dev_containers_feature_content_source=/tmp/devcontainercli-root/container-features/0.72.0-1738105208356 --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp /workspaces/basecloj/.devcontainer
[+] Building 1.3s (9/17)                                                                                           docker:default
 => [internal] load build definition from Dockerfile-with-features                                                           0.0s
 => => transferring dockerfile: 2.84kB                                                                                       0.0s
 => [internal] load .dockerignore                                                                                            0.0s
 => => transferring context: 2B                                                                                              0.0s
 => resolve image config for docker.io/docker/dockerfile:1.4                                                                 0.4s
 => CACHED docker-image://docker.io/docker/dockerfile:1.4@sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef  0.0s
 => [context dev_containers_feature_content_source] load .dockerignore                                                       0.0s
 => => transferring dev_containers_feature_content_source: 2B                                                                0.0s
 => [internal] load metadata for docker.io/library/clojure:temurin-21-tools-deps-jammy                                       0.4s
 => CACHED [dev_container_auto_added_stage_label 1/4] FROM docker.io/library/clojure:temurin-21-tools-deps-jammy@sha256:ebe  0.0s
 => [context dev_containers_feature_content_source] load from client                                                         0.0s
 => => transferring dev_containers_feature_content_source: 22.88kB                                                           0.0s
 => ERROR [dev_container_auto_added_stage_label 2/4] RUN groupadd --gid 1000      && useradd --uid 1000 --gid 1000 -m        0.4s
------
 > [dev_container_auto_added_stage_label 2/4] RUN groupadd --gid 1000      && useradd --uid 1000 --gid 1000 -m      && apt-get update     && apt-get install -y sudo     && echo  ALL=(root) NOPASSWD:ALL > /etc/sudoers.d/     && chmod 0440 /etc/sudoers.d/:
0.341 Usage: groupadd [options] GROUP
0.341 
0.341 Options:
0.341   -f, --force                   exit successfully if the group already exists,
0.341                                 and cancel -g if the GID is already used
0.341   -g, --gid GID                 use GID for the new group
0.341   -h, --help                    display this help message and exit
0.341   -K, --key KEY=VALUE           override /etc/login.defs defaults
0.341   -o, --non-unique              allow to create groups with duplicate
0.341                                 (non-unique) GID
0.341   -p, --password PASSWORD       use this encrypted password for the new group
0.341   -r, --system                  create a system account
0.341   -R, --root CHROOT_DIR         directory to chroot into
0.341   -P, --prefix PREFIX_DIR       directory prefix
0.341       --extrausers              Use the extra users database
0.341 
------
Dockerfile-with-features:11
--------------------
  10 |     # Create the user
  11 | >>> RUN groupadd --gid $USER_GID $USERNAME \
  12 | >>>     && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
  13 | >>>     #
  14 | >>>     # [Optional] Add sudo support. Omit if you don't need to install software after connecting.
  15 | >>>     && apt-get update \
  16 | >>>     && apt-get install -y sudo \
  17 | >>>     && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
  18 | >>>     && chmod 0440 /etc/sudoers.d/$USERNAME
  19 |         
--------------------
ERROR: failed to solve: process "/bin/sh -c groupadd --gid $USER_GID $USERNAME     && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME     && apt-get update     && apt-get install -y sudo     && echo $USERNAME ALL=\\(root\\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME     && chmod 0440 /etc/sudoers.d/$USERNAME" did not complete successfully: exit code: 2
[12171 ms] Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-root/container-features/0.72.0-1738105208356/Dockerfile-with-features -t vsc-basecloj-93cbbf93d1175c8cf32f6dd538d1ea9f635fddfbd28782b12b9240f6d38e4c28 --target dev_containers_target_stage --build-arg BASE_IMAGE=temurin-21-tools-deps-jammy --build-arg USERNAME= --build-context dev_containers_feature_content_source=/tmp/devcontainercli-root/container-features/0.72.0-1738105208356 --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp /workspaces/basecloj/.devcontainer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions