devcontainers-contrib / features

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

[Bug]: Localstack Conflicing With Python DevContainer Feature #421

Closed frankpengau closed 1 year ago

frankpengau commented 1 year ago

Feature id and version

"ghcr.io/devcontainers-contrib/features/localstack:2.0.19"

Devcontainer base Image

"mcr.microsoft.com/devcontainers/base:jammy"

What happened?

When using python and localstack feature together, it seems to fail when building the devcontainer.

devcontainer.json:

{
    "name": "Ubuntu",
    "image": "mcr.microsoft.com/devcontainers/base:jammy",
    "features": {
        "ghcr.io/devcontainers/features/python:1": {},
        "ghcr.io/devcontainers-contrib/features/localstack:2.0.19": {}
    }
}

However, not that big of an issue, since localstack includes python, but just thought to point it out since I noticed the bug.

Relevant log output

=> [dev_containers_target_stage 6/6] RUN --mount=type=bind,from=dev_co  142.4s
 => => # Waiting up to 2 seconds                                               
 => => # Press Ctrl-C to quit                                                  
 => => # ERROR: Feature "Localstack (via pipx)" (ghcr.io/devcontainers-contrib/
[2023-05-08T06:52:07.051Z]  => => # features/localstack) failed to install! Look at the documentation at h
 => => # ttp://github.com/devcontainers-contrib/features/tree/main/src/localsta
 => => # ck for help troubleshooting this error.     
...
...
=> ERROR [dev_containers_target_stage 6/6] RUN --mount=type=bind,from=  142.5s

[2023-05-08T06:52:07.153Z]                 

------
 > [dev_containers_target_stage 6/6] RUN --mount=type=bind,from=dev_containers_feature_content_source,source=localstack_2,target=/tmp/build-features-src/localstack_2     cp -ar /tmp/build-features-src/localstack_2 /tmp/dev-container-features  && chmod -R 0755 /tmp/dev-container-features/localstack_2  && cd /tmp/dev-container-features/localstack_2  && chmod +x ./devcontainer-features-install.sh  && ./devcontainer-features-install.sh  && rm -rf /tmp/dev-container-features/localstack_2:
#0 0.140 ===========================================================================
[2023-05-08T06:52:07.153Z] 
#0 0.140 Feature       : Localstack (via pipx)
#0 0.140 Description   : Localstack is a fully functional local AWS cloud stack.
#0 0.140 Id            : ghcr.io/devcontainers-contrib/features/localstack
#0 0.140 Version       : 2.0.19
#0 0.140 Documentation : http://github.com/devcontainers-contrib/features/tree/main/src/localstack
#0 0.140 Options       :
#0 0.140     VERSION="latest"
#0 0.140 ===========================================================================
#0 0.143 bash: cannot set terminal process group (1): Inappropriate ioctl for device
#0 0.143 bash: no job control in this shell
#0 2.540 nanolayer
#0 7.221 cd /tmp/tmpm3fderq0 && chmod +x -R . && _REMOTE_USER="vscode" _REMOTE_USER_HOME="/home/vscode" PACKAGES="build-essential,libsasl2-dev,g++" PPAS="" CLEAN_PPAS="true" PRESERVE_APT_LIST="true" FORCE_PPAS_ON_NON_UBUNTU="false" NANOLAYER_VERBOSE="" NANOLAYER_FORCE_CLI_INSTALLATION="" NANOLAYER_PROPAGATE_CLI_LOCATION="1" NANOLAYER_CLI_LOCATION="/tmp/nanolayer-onGvf66TCb/nanola
[2023-05-08T06:52:07.153Z] yer" bash  -i  +H ./install.sh
#0 7.221 Found a pre-existing nanolayer which were given in env varialbe: /tmp/nanolayer-onGvf66TCb/nanolayer

#0 7.339 skipping usage of pre-existing nanolayer. (required version v0.4.27 does not match existing version v0.4.35)

#0 9.628 nanolayer

#0 10.10 cp -p -R /var/lib/apt/lists /tmp/tmprm9bwk3j

#0 10.13 apt-get update -y
...
...
#0 135.4 /usr/bin/install -c -m 644 ./Lib/test/decimaltestdata/dqRemainderNear.decTest /usr/local/python/3.10.11/lib/python3.10/test/decimaltestdata

#0 135.4 /usr/bin/install -c -m 644 ./Lib/test/decimaltestdata/dqRotate.decTest /usr/local/python/3.10.11/lib/python3.10/test/decimaltestdata

#0 135.4 /usr/bin/install -c -m 644 ./Lib/test/decimaltestdata/dqSameQuantum.decTest /usr/local/python/3.10.11/lib/python3.10/test/decimaltestdata
[2023-05-08T06:52:07.186Z] Stop (149581 ms): Run: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) --ms-enable-electron-run-as-node /Users/frank.peng/.vscode/extensions/ms-vscode-remote.remote-containers-0.292.0/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/frank.peng/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --container-session-data-folder /tmp/devcontainers-55e16232-6b1b-487f-bf6a-39a498d3d4cf1683528576793 --workspace-folder /Users/frank.peng/Repos/experiments/vscode-devcontainer-localstack --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/frank.peng/Repos/experiments/vscode-devcontainer-localstack --id-label devcontainer.config_file=/Users/frank.peng/Repos/experiments/vscode-devcontainer-localstack/.devcontainer/devcontainer.json --log-level debug --log-format json --config /Users/frank.peng/Repos/experiments/vscode-devcontainer-localstack/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --build-no-cache --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2023-05-08T06:52:07.186Z] Exit code 1
[2023-05-08T06:52:07.188Z] Command failed: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) --ms-enable-electron-run-as-node /Users/frank.peng/.vscode/extensions/ms-vscode-remote.remote-containers-0.292.0/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/frank.peng/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --container-session-data-folder /tmp/devcontainers-55e16232-6b1b-487f-bf6a-39a498d3d4cf1683528576793 --workspace-folder /Users/frank.peng/Repos/experiments/vscode-devcontainer-localstack --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/frank.peng/Repos/experiments/vscode-devcontainer-localstack --id-label devcontainer.config_file=/Users/frank.peng/Repos/experiments/vscode-devcontainer-localstack/.devcontainer/devcontainer.json --log-level debug --log-format json --config /Users/frank.peng/Repos/experiments/vscode-devcontainer-localstack/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --build-no-cache --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2023-05-08T06:52:07.188Z] Exit code 1
frankpengau commented 1 year ago

Troubleshooting branch for full logs: https://github.com/frankpengau/vscode-devcontainer-localstack/tree/localstack-troubleshooting-2023-05-08

danielbraun89 commented 1 year ago

@frankpengau thanks for reporting! The problem was indeed installing python twice. The reason localstack installs its own python because localstack is not compatible yet with python 3.11 so the way of explicitly installing python 3.10 was chosen. However there was problem in the overriding mechanism when installing after a pre-installed python feature. The most appropriate solution was to not override the default python installation at all. Instead python 3.10 is now installed side by side with whatever the current python version happens to be (for it to serve only as a localstack launchpad.)

Latest localstack version ghcr.io/devcontainers-contrib/features/localstack:2.0.20 should solve this Also a test was added to check this scenario in the future