devcontainers / templates

Repository for Dev Container Templates that are managed by Dev Container spec maintainers. See https://github.com/devcontainers/template-starter to create your own!
https://containers.dev/templates
MIT License
924 stars 242 forks source link

Miniconda Python 3 Devcontainer - Permission Denied #154

Closed joshuanianji closed 1 year ago

joshuanianji commented 1 year ago

Hello! I've been trying to develop with the miniconda devcontainer and have run into Permission Denied errors on initialization.

Recreate

  1. Open an empty folder in VSCode
  2. Reopen in Container > "Miniconda (Python 3)" > no features

It seems that there is a permission error deleting /tmp/conda-tmp in line 7 of the Dockerfile, and this affect projects both with and without an environment.yml. https://github.com/devcontainers/templates/blob/main/src/miniconda/.devcontainer/Dockerfile#L6-L7C29

Interestingly, there is no issue when I use the anaconda devcontainer.

Here is a sample of the error log when I open the devcontainer without an environment.yml:

[2023-05-09T15:58:53.494Z]  => [dev_container_auto_added_stage_label 2/3] COPY environment.yml* .dev  0.1s
 => ERROR [dev_container_auto_added_stage_label 3/3] RUN if [ -f "/tmp/co  0.4s
------
 > [dev_container_auto_added_stage_label 3/3] RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi     && rm -rf /tmp/conda-tmp:
#0 0.343 rm: cannot remove '/tmp/conda-tmp/noop.txt': Permission denied
------
[2023-05-09T15:58:53.496Z] Dockerfile-with-features:8
[2023-05-09T15:58:53.508Z] 
--------------------
   7 |     COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
   8 | >>> RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
   9 | >>>     && rm -rf /tmp/conda-tmp
  10 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c if [ -f \"/tmp/conda-tmp/environment.yml\" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi     && rm -rf /tmp/conda-tmp" did not complete successfully: exit code: 1
[2023-05-09T15:58:53.517Z] Stop (882 ms): Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-joshua/container-features/0.40.0-1683647932612/Dockerfile-with-features -t vsc-miniconda-test-c11d0cef61eb803f5f102413a7ecf9a90c41929cdeff7f00ca3504e3739142d9 --target dev_containers_target_stage --no-cache --pull --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /home/joshua/test/miniconda-test
[2023-05-09T15:58:53.436Z] Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-joshua/container-features/0.40.0-1683647932612/Dockerfile-with-features -t 

Fixes

I've just been using the anaconda devcontainer in the meantime, although it is quite a bit bigger (5GB compared to 1.58)

samruddhikhandale commented 1 year ago

Hi 👋

Thanks for reporting, @alexander-smolyakov can you help prioritize and investigate this issue? thanks!

ℹ️ I was able to reproduce the scenario as well.

alexander-smolyakov commented 1 year ago

@joshuanianji, @samruddhikhandale, quick update: The issue comes from the mcr.microsoft.com/devcontainers/miniconda:0-3 image. The issue started to appear from the 0.202.19-3 image version. I'm going to investigate recent changes for the miniconda devcontainer to determine the root cause of the issue.

joshuanianji commented 1 year ago

Thank you! Should I wait a few days for the new image to be published and available?

samruddhikhandale commented 1 year ago

Yes, we plan on publishing early next week.

joshuanianji commented 1 year ago

That's awesome, thank you so much! I'll close this issue once I test the newly published image then

joshuanianji commented 1 year ago

Working now with devcontainers/images v0.3.6 release!