Skip to content

Git Feature - Add OS support for Alpine #824

Open

Description

@LavissaWoW

#782 added distro checks that excludes the Alpine distro. This has effectively broken building images with git for Alpine.

------
 > [dev_containers_target_stage 4/4] RUN --mount=type=bind,from=dev_containers_feature_content_source,source=git_0,target=/tmp/build-features-src/git_0     cp -ar /tmp/build-features-src/git_0 /tmp/dev-container-features  && chmod -R 0755 /tmp/dev-container-features/git_0  && cd /tmp/dev-container-features/git_0  && chmod +x ./devcontainer-features-install.sh  && ./devcontainer-features-install.sh  && rm -rf /tmp/dev-container-features/git_0:
0.310 ===========================================================================
[2024-01-30T21:00:27.731Z] 
0.310 Feature       : Git (from source)
0.310 Description   : Install an up-to-date version of Git, built from source as needed. Useful for when you want the latest and greatest features. Auto-detects latest stable version and installs needed dependencies.
[2024-01-30T21:00:27.731Z] 0.310 Id            : git
0.310 Version       : 1.2.0
0.310 Documentation : https://github.com/devcontainers/features/tree/main/src/git
0.310 Options       :
0.310     VERSION="os-provided"
0.310     PPA="true"
0.310 ===========================================================================
0.316 Linux distro alpine not supported.
[2024-01-30T21:00:27.732Z] 0.316 ERROR: Feature "Git (from source)" (git) failed to install! Look at the documentation at https://github.com/devcontainers/features/tree/main/src/git for help troubleshooting this error.
------

Activity

  1. samruddhikhandale commented on Jan 31, 2024

    @samruddhikhandale
    Member

    Hi 👋

    According to https://github.com/devcontainers/features/tree/main/src/git#os-support, we officially never added support for Alpine to the Git Feature.

    Lavissa (@LavissaWoW) Does v1.1.6 of the Git Feature with the alpine image work fine for you? If so, we can start officially supporting it.

    Feel free to contribute a PR if needed, we appreciate community support. Thanks!

  2. jdputschadi commented on Feb 1, 2024

    @jdputschadi
    Contributor

    Because I authored the offending PR, I wanted to do some due diligence about the git feature version 1.1.6 (pre-PR #782 ) and trying to use it with an Alpine base image. I would gladly add tests and code to make sure 1.2.x releases worked with Alpine if the the 1.1.6 release worked with Alpine, that is fix something I broke.

    With respect to the git feature at version 1.1.6 and Alpine images:

    Using devcontainer features test to test with an alpine:latest base image:

    % devcontainer features test -f git  --skip-scenarios --base-image alpine
    
    ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐
    |    Dev Container Features   |   
    │           v0.54.2           │
    └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘
    
    >  baseImage:         alpine
    >  Target Folder:     /Users/Jeff.Putsch/src/adi/devcontainers-features
    >  features:          git
    >  workspaceFolder:   /var/folders/zq/nypww8ks687_q1jk13yrsqdh0000gp/T/devcontainercli/container-features-test/1706813916737
    
    ⏳ Building test container...
    
    [1 ms] @devcontainers/cli 0.54.2. Node.js v18.19.0. darwin 23.2.0 arm64.
    [90 ms] Resolving Feature dependencies for './git'...
    [1121 ms] Soft-dependency 'ghcr.io/devcontainers/features/common-utils' is not required.  Removing from installation order...
    [1161 ms] Start: Run: docker buildx build --load --build-context dev_containers_feature_content_source=/var/folders/zq/nypww8ks687_q1jk13yrsqdh0000gp/T/devcontainercli/container-features/0.54.2-1706813916889 --build-arg _DEV_CONTAINERS_BASE_IMAGE=alpine --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -t vsc-1706813916737-7211447c997762c8fe7aae5d11ea49211c21df1317e532e4826be82b315fef59-features -f /var/folders/zq/nypww8ks687_q1jk13yrsqdh0000gp/T/devcontainercli/container-features/0.54.2-1706813916889/Dockerfile.extended /var/folders/zq/nypww8ks687_q1jk13yrsqdh0000gp/T/devcontainercli/empty-folder
    [+] Building 0.9s (14/14) FINISHED                                                                                                                      docker-container:dev-containers-builder
     => [internal] load build definition from Dockerfile.extended                                                                                                                              0.0s
     => => transferring dockerfile: 1.59kB                                                                                                                                                     0.0s
     => resolve image config for docker.io/docker/dockerfile:1.4                                                                                                                               0.5s
     => CACHED docker-image://docker.io/docker/dockerfile:1.4@sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0dbc                                                          0.0s
     => => resolve docker.io/docker/dockerfile:1.4@sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0dbc                                                                     0.0s
     => [internal] load .dockerignore                                                                                                                                                          0.0s
     => => transferring context: 2B                                                                                                                                                            0.0s
     => [internal] load metadata for docker.io/library/alpine:latest                                                                                                                           0.2s
     => [context dev_containers_feature_content_source] load .dockerignore                                                                                                                     0.0s
     => => transferring dev_containers_feature_content_source: 2B                                                                                                                              0.0s
     => [dev_containers_feature_content_normalize 1/3] FROM docker.io/library/alpine@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b                                   0.0s
     => => resolve docker.io/library/alpine@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b                                                                            0.0s
     => [context dev_containers_feature_content_source] load from client                                                                                                                       0.0s
     => => transferring dev_containers_feature_content_source: 11.14kB                                                                                                                         0.0s
     => CACHED [dev_containers_target_stage 2/5] RUN mkdir -p /tmp/dev-container-features                                                                                                      0.0s
     => CACHED [dev_containers_feature_content_normalize 2/3] COPY --from=dev_containers_feature_content_source devcontainer-features.builtin.env /tmp/build-features/                         0.0s
     => CACHED [dev_containers_feature_content_normalize 3/3] RUN chmod -R 0755 /tmp/build-features/                                                                                           0.0s
     => CACHED [dev_containers_target_stage 3/5] COPY --from=dev_containers_feature_content_normalize /tmp/build-features/ /tmp/dev-container-features                                         0.0s
     => CACHED [dev_containers_target_stage 4/5] RUN echo "_CONTAINER_USER_HOME=$( (command -v getent >/dev/null 2>&1 && getent passwd 'root' || grep -E '^root|^[^:]*:[^:]*:root:' /etc/pass  0.0s
     => ERROR [dev_containers_target_stage 5/5] RUN --mount=type=bind,from=dev_containers_feature_content_source,source=git_0,target=/tmp/build-features-src/git_0     cp -ar /tmp/build-feat  0.0s
    ------
     > [dev_containers_target_stage 5/5] RUN --mount=type=bind,from=dev_containers_feature_content_source,source=git_0,target=/tmp/build-features-src/git_0     cp -ar /tmp/build-features-src/git_0 /tmp/dev-container-features  && chmod -R 0755 /tmp/dev-container-features/git_0  && cd /tmp/dev-container-features/git_0  && chmod +x ./devcontainer-features-install.sh  && ./devcontainer-features-install.sh  && rm -rf /tmp/dev-container-features/git_0:
    0.027 ===========================================================================
    0.027 Feature       : Git (from source)
    0.027 Description   : Install an up-to-date version of Git, built from source as needed. Useful for when you want the latest and greatest features. Auto-detects latest stable version and installs needed dependencies.
    0.027 Id            : Unknown
    0.027 Version       : 1.1.6
    0.027 Documentation : https://github.com/devcontainers/features/tree/main/src/git
    0.027 Options       :
    0.027     VERSION="os-provided"
    0.027     PPA="true"
    0.027 ===========================================================================
    0.028 env: can't execute 'bash': No such file or directory
    0.028 ERROR: Feature "Git (from source)" (Unknown) failed to install! Look at the documentation at https://github.com/devcontainers/features/tree/main/src/git for help troubleshooting this error.
    ------
    Dockerfile.extended:24
    --------------------
      23 |     
      24 | >>> RUN --mount=type=bind,from=dev_containers_feature_content_source,source=git_0,target=/tmp/build-features-src/git_0 \
      25 | >>>     cp -ar /tmp/build-features-src/git_0 /tmp/dev-container-features \
      26 | >>>  && chmod -R 0755 /tmp/dev-container-features/git_0 \
      27 | >>>  && cd /tmp/dev-container-features/git_0 \
      28 | >>>  && chmod +x ./devcontainer-features-install.sh \
      29 | >>>  && ./devcontainer-features-install.sh \
      30 | >>>  && rm -rf /tmp/dev-container-features/git_0
      31 |     
    --------------------
    ERROR: failed to solve: process "/bin/sh -c cp -ar /tmp/build-features-src/git_0 /tmp/dev-container-features  && chmod -R 0755 /tmp/dev-container-features/git_0  && cd /tmp/dev-container-features/git_0  && chmod +x ./devcontainer-features-install.sh  && ./devcontainer-features-install.sh  && rm -rf /tmp/dev-container-features/git_0" did not complete successfully: exit code: 127
    [-] Failed to launch container:
    
    Command failed: docker buildx build --load --build-context dev_containers_feature_content_source=/var/folders/zq/nypww8ks687_q1jk13yrsqdh0000gp/T/devcontainercli/container-features/0.54.2-1706813916889 --build-arg _DEV_CONTAINERS_BASE_IMAGE=alpine --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -t vsc-1706813916737-7211447c997762c8fe7aae5d11ea49211c21df1317e532e4826be82b315fef59-features -f /var/folders/zq/nypww8ks687_q1jk13yrsqdh0000gp/T/devcontainercli/container-features/0.54.2-1706813916889/Dockerfile.extended /var/folders/zq/nypww8ks687_q1jk13yrsqdh0000gp/T/devcontainercli/empty-folder
    

    Try alpine:latest as base image, installing common-utils first:

    I tried making a scenario for Alpine using the 1.1.6 features and an alpine:latest base image where the scenario installed common-utils first and that fails to build during the install of common-utils.

    Test common-utils alone vs. Alpine:

    These fail for the tests that use alpine:latest for the base image, but work for the test that use alpine:3.14 and alpine:3.15 for the base image.

    Test the git feature using mcr.microsoft.com/devcontainers/base:alpine for the base image:

    These fail with ./install.sh: line 68: apt-get: command not found errors.

    My conclusion: this feature did not work with Alpine base images before PR #782

    Jeff.

  3. samruddhikhandale commented on Feb 1, 2024

    @samruddhikhandale
    Member

    Appreciate the investigations and details results Jeff Putsch (@jdputschadi) . Thanks!

    My conclusion: this feature did not work with Alpine base images before PR #782

    I would have expected the same results ^.

    Lavissa (@LavissaWoW) Feel free to share the devcontainer where it was working for you. However, we can only add Alpine support if it's fully working and shouldn't confuse the community with a partial/half-baked support.

  4. LavissaWoW commented on Feb 1, 2024

    @LavissaWoW
    Author

    Hey all 😊

    Before 1.2.0, we had working git commands after building devcontainers. However... Looking into things, it seems that it was a byproduct of the software we install in the devcontainer.

    As such, it seemed that the git feature worked for us. What's really happening is that the software being installed has git as a dependency. So it looked like the git feature was working, while it never actually was applied during build.

    So... Git itself works fine with Alpine. But the devcontainer git feature doesn't properly support Alpine. Might just be due to different package managers. But I'll leave it up to you if you want to add support for Alpine and its packages.

    On our end, we can remove the git feature, as the software dependencies install git.

  5. changed the title [-]Latest PR for git feature broke support for Alpine images[/-] [+]Git Feature - Add OS support for Alpine[/+] on Feb 1, 2024
  6. samruddhikhandale commented on Feb 1, 2024

    @samruddhikhandale
    Member

    Great, thanks for the clarification. Appreciate it!

    I'll keep this issue open as a feature request.

  7. tobiasdiez commented on May 12, 2025

    @tobiasdiez

    For the record, void linux is apparently also not supported.

  8. piotr-cz commented on May 25, 2026

    @piotr-cz

    There is a alpine-bash feature that should unlock git feature: ghcr.io/cirolosapio/devcontainers-features/alpine-bash:0

  9. lkraav commented on Aug 31, 2026

    @lkraav

    Seems this issue could've been closed with #1008?

    2026 Q3: I successfully added git feature on Alpine image as of today, so seems to work as designed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions