devcontainers / features

A collection of Dev Container Features managed by Dev Container spec maintainers. See https://github.com/devcontainers/feature-starter to publish your own
https://containers.dev/features
MIT License
941 stars 385 forks source link

python feature not compatible with alpine - better error message #498

Open hediet opened 1 year ago

hediet commented 1 year ago

This is my devcontainer.json:

{
    "name": "Alpine",
    "image": "mcr.microsoft.com/devcontainers/base:alpine-3.17",
    "features": {
        "jupyterlab": "latest"
    }
}

Opening the dev container produces the following error:

#0 0.453 Feature       : Python
#0 0.453 Description   : Installs the provided version of Python, as well as PIP
X, and other common Python utilities.  JupyterLab is conditionally installed wit
h the python feature. Note: May require source code compilation.
#0 0.453 Id            : ghcr.io/devcontainers/features/python
#0 0.453 Version       : 1.0.22
#0 0.453 Documentation : https://github.com/devcontainers/features/tree/main/src
/python
#0 0.453 Options       :
#0 0.453     VERSION="os-provided"
#0 0.453     INSTALLTOOLS="true"
#0 0.453     OPTIMIZE="false"
#0 0.453     INSTALLPATH="/usr/local/python"
#0 0.453     INSTALLJUPYTERLAB="true"
#0 0.453     CONFIGUREJUPYTERLABALLOWORIGIN=""
#0 0.453 =======================================================================
====
#0 0.461 find: /var/lib/apt/lists/*: No such file or directory
#0 0.461 Running apt-get update...
#0 0.462 ./install.sh: line 190: apt-get: command not found
#0 0.462 ERROR: Feature "Python" (ghcr.io/devcontainers/features/python) failed
to install! Look at the documentation at https://github.com/devcontainers/featur
es/tree/main/src/python for help troubleshooting this error.
------
ERROR: failed to solve: executor failed running [/bin/sh -c cp -ar /tmp/build-fe
atures-src/python_1 /tmp/dev-container-features  && chmod -R 0755 /tmp/dev-conta
iner-features/python_1  && cd /tmp/dev-container-features/python_1  && chmod +x
./devcontainer-features-install.sh  && ./devcontainer-features-install.sh  && rm
 -rf /tmp/dev-container-features/python_1]: exit code: 127
[2023-03-21T14:29:13.133Z] Stop (11226 ms): Run: docker buildx build --load --build-context dev_containers_feature_content_source=C:\Users\HDIETE~1\AppData\Local\Temp\devcontainercli\container-features\0.35.0-1679408939387 --build-arg _DEV_CONTAINERS_BASE_IMAGE=mcr.microsoft.com/devcontainers/base:alpine-3.17 --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-empty-10-1f396861a10f128c309c552ae61065dd99209e8c7e4251e759728873139538a1-features -f C:\Users\HDIETE~1\AppData\Local\Temp\devcontainercli\container-features\0.35.0-1679408939387\Dockerfile.extended c:\Users\hdieterichs\AppData\Roaming\Code - Insiders\User\globalStorage\ms-vscode-remote.remote-containers\data\empty-folder
[2023-03-21T14:29:13.134Z] Error: Command failed: docker buildx build --load --build-context dev_containers_feature_content_source=C:\Users\HDIETE~1\AppData\Local\Temp\devcontainercli\container-features\0.35.0-1679408939387 --build-arg _DEV_CONTAINERS_BASE_IMAGE=mcr.microsoft.com/devcontainers/base:alpine-3.17 --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-empty-10-1f396861a10f128c309c552ae61065dd99209e8c7e4251e759728873139538a1-features -f C:\Users\HDIETE~1\AppData\Local\Temp\devcontainercli\container-features\0.35.0-1679408939387\Dockerfile.extended c:\Users\hdieterichs\AppData\Roaming\Code - Insiders\User\globalStorage\ms-vscode-remote.remote-containers\data\empty-folder
[2023-03-21T14:29:13.135Z]     at bse (c:\Users\hdieterichs\.vscode-insiders\extensions\ms-vscode-remote.remote-containers-0.286.0\dist\spec-node\devContainersSpecCLI.js:1916:3264)
[2023-03-21T14:29:13.135Z]     at J7 (c:\Users\hdieterichs\.vscode-insiders\extensions\ms-vscode-remote.remote-containers-0.286.0\dist\spec-node\devContainersSpecCLI.js:1916:3200)
[2023-03-21T14:29:13.135Z]     at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
[2023-03-21T14:29:13.135Z]     at async $se (c:\Users\hdieterichs\.vscode-insiders\extensions\ms-vscode-remote.remote-containers-0.286.0\dist\spec-node\devContainersSpecCLI.js:1931:2626)
[2023-03-21T14:29:13.135Z]     at async Ah (c:\Users\hdieterichs\.vscode-insiders\extensions\ms-vscode-remote.remote-containers-0.286.0\dist\spec-node\devContainersSpecCLI.js:1931:3741)
[2023-03-21T14:29:13.135Z]     at async aae (c:\Users\hdieterichs\.vscode-insiders\extensions\ms-vscode-remote.remote-containers-0.286.0\dist\spec-node\devContainersSpecCLI.js:2059:17376)
[2023-03-21T14:29:13.136Z]     at async oae (c:\Users\hdieterichs\.vscode-insiders\extensions\ms-vscode-remote.remote-containers-0.286.0\dist\spec-node\devContainersSpecCLI.js:2059:17117)
[2023-03-21T14:29:13.148Z] Stop (16594 ms): Run: C:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\Code - Insiders.exe --ms-enable-electron-run-as-node c:\Users\hdieterichs\.vscode-insiders\extensions\ms-vscode-remote.remote-containers-0.286.0\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\hdieterichs\AppData\Roaming\Code - Insiders\User\globalStorage\ms-vscode-remote.remote-containers\data --container-session-data-folder /tmp/devcontainers-d604bc2e-4ea1-4b4f-b4ea-ad09f82488671679408921808 --workspace-folder c:\dev\temp\empty-10 --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\dev\temp\empty-10 --id-label devcontainer.config_file=c:\dev\temp\empty-10\.devcontainer\devcontainer.json --log-level debug --log-format json --config c:\dev\temp\empty-10\.devcontainer\devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=\\wsl.localhost\Ubuntu\mnt\wslg\runtime-dir\wayland-0,target=/tmp/vscode-wayland-127d2c1e-b7f4-4bb9-8cd7-636dd4794297.sock --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2023-03-21T14:29:13.148Z] Exit code 1
[2023-03-21T14:29:13.153Z] Command failed: C:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\Code - Insiders.exe --ms-enable-electron-run-as-node c:\Users\hdieterichs\.vscode-insiders\extensions\ms-vscode-remote.remote-containers-0.286.0\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\hdieterichs\AppData\Roaming\Code - Insiders\User\globalStorage\ms-vscode-remote.remote-containers\data --container-session-data-folder /tmp/devcontainers-d604bc2e-4ea1-4b4f-b4ea-ad09f82488671679408921808 --workspace-folder c:\dev\temp\empty-10 --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\dev\temp\empty-10 --id-label devcontainer.config_file=c:\dev\temp\empty-10\.devcontainer\devcontainer.json --log-level debug --log-format json --config c:\dev\temp\empty-10\.devcontainer\devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=\\wsl.localhost\Ubuntu\mnt\wslg\runtime-dir\wayland-0,target=/tmp/vscode-wayland-127d2c1e-b7f4-4bb9-8cd7-636dd4794297.sock --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2023-03-21T14:29:13.153Z] Exit code 1

The error #0 0.462 ./install.sh: line 190: apt-get: command not found sounds like the user did something wrong.

It would be much more helpful to get a clear error message saying that the python feature does not support the alpine distro.

samruddhikhandale commented 1 year ago

Hi 👋

Every Feature currently has a OS support section in the README. However, I agree we should add clear messages in the Feature itself 💡 Thanks!

hediet commented 1 year ago

Then I suggest to make the OS support section machine readable and offer a linting rule in the devcontainer json in VS Code.