devcontainers-contrib / features

🐳 Extra add-in features for Devcontainers and GitHub Codespaces
MIT License
241 stars 126 forks source link

[Bug]: ./devcontainer-features-install.sh: line 28: ./install.sh: not found #497

Open c3n21 opened 1 year ago

c3n21 commented 1 year ago

Feature id and version

ghcr.io/devcontainers-contrib/features/pnpm:2

Devcontainer base Image

alpine:3.18.2

What happened?

Given the following .devcontainer/devcontainer.json

{
  "image": "alpine:3.18.2",
  "features": {
    "ghcr.io/devcontainers-contrib/features/pnpm:2": {}
  },
  "remoteUser": "root"
}

and running

devcontainer up --workspace-folder .

I get this error

./devcontainer-features-install.sh: line 28: ./install.sh: not found at step 6/9.

This devcontainer@0.49.0 /usr/lib/node_modules/@devcontainers/cli is the version of devcontainer I am using.

I tried also with nx feature and get the same error.

I tried with both Docker and Podman.

Relevant log output

ERROR: Feature "Pnpm (via npm)" (ghcr.io/devcontainers-contrib/features/pnpm) failed to install! Look at the documentation at http://github.com/devcontainers-contrib/features/tree/main/src/pnpm for help troubleshooting this error.
Error: building at STEP "RUN --mount=type=bind,from=dev_containers_feature_content_source,source=pnpm_0,target=/tmp/build-features-src/pnpm_0 cp -ar /tmp/build-features-src/pnpm_0 /tmp/dev-container-features  && chmod -R 0755 /tmp/dev-container-features/pnpm_0  && cd /tmp/dev-container-features/pnpm_0  && chmod +x ./devcontainer-features-install.sh  && ./devcontainer-features-install.sh  && rm -rf /tmp/dev-container-features/pnpm_0": while running runtime: exit status 127
Error: Command failed: docker buildx build --load --build-context dev_containers_feature_content_source=/tmp/devcontainercli-zhifan/container-features/0.49.0-1690662645193 --build-arg _DEV_CONTAINERS_BASE_IMAGE=alpine:3.18.2 --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-setup-dd9573fc3f8a0cb60d4a380b16a0d83ca9214f5909124efaa59bdbe3753e7911-features -f /tmp/devcontainercli-zhifan/container-features/0.49.0-1690662645193/Dockerfile.extended /tmp/devcontainercli-zhifan/empty-folder
    at Jte (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:2030:1066)
    at d3 (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:2030:1002)
    at async hre (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:2047:3660)
    at async Zf (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:2047:4775)
    at async Bne (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:2179:12193)
    at async Rne (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:2179:11934)
{"outcome":"error","message":"Command failed: docker buildx build --load --build-context dev_containers_feature_content_source=/tmp/devcontainercli-zhifan/container-features/0.49.0-1690662645193 --build-arg _DEV_CONTAINERS_BASE_IMAGE=alpine:3.18.2 --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-setup-dd9573fc3f8a0cb60d4a380b16a0d83ca9214f5909124efaa59bdbe3753e7911-features -f /tmp/devcontainercli-zhifan/container-features/0.49.0-1690662645193/Dockerfile.extended /tmp/devcontainercli-zhifan/empty-folder","description":"An error occurred setting up the container."}
danielbraun89 commented 1 year ago

@c3n21 thanks for reporting this bug Unfortunately this bug happens due to the usage of an alpine based image alpine currently is not supported for multiple reasons:

  1. The devcontainer library scripts contains /bin/bash shebang (bash is not installed on alpine by default). (That is what causing the install.sh not found error you encountered
  2. The base features used are assuming debian (for example the official nodejs feature is installing packages using apt-get , the official python feature too)

Reason 1 is solvable in the scope of this repo, but Reason 2 is sadly require deeper fix, probably a replacement for these official features that serve as the basis of many other features, or update them to be more distro agnostic.