Coder Social home page Coder Social logo

mamba-org / micromamba-devcontainer Goto Github PK

View Code? Open in Web Editor NEW
39.0 39.0 6.0 535 KB

A micromamba-based VS Code development container image.

License: MIT License

Dockerfile 4.75% Shell 88.51% Python 6.74%
devcontainer docker micromamba vscode

micromamba-devcontainer's People

Contributors

basnijholt avatar maresb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

micromamba-devcontainer's Issues

Permission denied error when running `pre-commit`

Trying to use this devcontainer on a project also using pre-commit.

Getting the following error when committing changes, or running pre-commit manually:

An unexpected error has occurred: PermissionError: [Errno 13] Permission denied: '/mnt/cache'
Traceback (most recent call last):
  File "/opt/conda/lib/python3.10/site-packages/pre_commit/error_handler.py", line 73, in error_handler
    yield
  File "/opt/conda/lib/python3.10/site-packages/pre_commit/main.py", line 340, in main
    store = Store()
  File "/opt/conda/lib/python3.10/site-packages/pre_commit/store.py", line 51, in __init__
    os.makedirs(self.directory, exist_ok=True)
  File "/opt/conda/lib/python3.10/os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/opt/conda/lib/python3.10/os.py", line 225, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/mnt/cache'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/bin/pre-commit", line 11, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.10/site-packages/pre_commit/main.py", line 337, in main
    with error_handler(), logging_handler(args.color):
  File "/opt/conda/lib/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/opt/conda/lib/python3.10/site-packages/pre_commit/error_handler.py", line 81, in error_handler
    _log_and_exit(msg, ret_code, e, traceback.format_exc())
  File "/opt/conda/lib/python3.10/site-packages/pre_commit/error_handler.py", line 31, in _log_and_exit
    storedir = Store().directory
  File "/opt/conda/lib/python3.10/site-packages/pre_commit/store.py", line 51, in __init__
    os.makedirs(self.directory, exist_ok=True)
  File "/opt/conda/lib/python3.10/os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/opt/conda/lib/python3.10/os.py", line 225, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/mnt/cache'

After briefly looking at the source, it might be related to the following logic:

# Symlink the cache directories to the corresponding locations in home directory.
RUN : \
&& mkdir -p "/home/${MAMBA_USER}/.vscode-server" \
&& ln -s "/mnt/cache/vscode-server-extensions" "/home/${MAMBA_USER}/.vscode-server/extensions" \
&& mkdir -p "/home/${MAMBA_USER}/.cache" \
&& ln -s "/mnt/cache/pre-commit" "/home/${MAMBA_USER}/.cache/pre-commit" \
;

This is reproducible by creating a Codespace from https://github.com/maresb/micromamba-devcontainer-example:

image

image

No Git username/password in Codespaces

Does anyone know if Codespaces has any way of communicating your name and e-mail so that it doesn't have to be configured every time?

When I run VS Code as an application, it always seamlessly forwards my local credentials, including my GPG key.

(base) mambauser@codespaces-305e2e:/workspaces/micromamba-devcontainer-example$ git commit -m "aowfeij" --allow-empty
Author identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'mambauser@codespaces-305e2e.(none)')

After briefly looking around, I see the environment variable GITHUB_USER=maresb, but that's not enough. I also see VSCODE_GIT_IPC_HANDLE=/tmp/vscode-git-db9813fb72.sock but I can't find any docs about it.

Old devcontainer images gone

As this project has been migrated from my personal account to mamba-org, unfortunately it seems like the GHCR images are no longer accessible.

I'm not sure how to fix this, but I recommend updating to the latest image, currently:

FROM ghcr.io/mamba-org/micromamba-devcontainer:git-e56c5fc

Sorry about the inconvenience, this was a bit unexpected.

Can not build devcontainer: Operation not permitted

I can not build the devcontainer which I created using cruft create https://github.com/maresb/cookiecutter-micromamba-devcontainer:

 => [ 5/13] RUN :     && micromamba config append channels conda-forge     0.5s
 => => # terminate called after throwing an instance of 'std::system_error'    
 => => #   what():  Operation not permitted     

I tried to comment out the this step to see how far it gets, but then, the following pipx install step fails.

VS Code log file: remoteContainers-2023-06-27T08-49-37.276Z.log

Version: 1.70.2
Commit: e4503b30fc78200f846c62cf8091b76ff5547662
Date: 2022-08-16T05:36:25.715Z
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Linux x64 5.15.0-75-generic

Interestingly, even running the bare docker image does not work:

$ docker run --rm -it ghcr.io/mamba-org/micromamba-devcontainer:git-d175103
Unable to find image 'ghcr.io/mamba-org/micromamba-devcontainer:git-d175103' locally
git-d175103: Pulling from mamba-org/micromamba-devcontainer
[...]
Digest: sha256:fb56b66c8993ee752840daa5b9cfdaff6e53a089bafae858b92870a9cd05c3d8
Status: Downloaded newer image for ghcr.io/mamba-org/micromamba-devcontainer:git-d175103
terminate called after throwing an instance of 'std::system_error'
  what():  Operation not permitted
terminate called after throwing an instance of 'std::system_error'
  what():  Operation not permitted
/usr/local/bin/_activate_current_env.sh: line 35:    14 Aborted                 (core dumped) micromamba activate "${ENV_NAME}"

image location not in `README.md`

In the README.md, I don't see a pointer to where the image resides in an image repo. Currently, you have to dig into the examples or issues to find this information.

Consider transitioning to Dev Container Feature & Dev Container Templates

Dev Container Spec is now open and individual features (to install something or to setting something) are intended to be used in combination like Lego blocks, so it is recommended to publish them as Dev Container Features instead of writing them in the Dockerfile.

Also, by publishing Dev Container Templates, users can import templates from the Internet using the devcontainer CLI or VSCode Dev Container.

See below for published Features and Templates.
https://containers.dev/features
https://containers.dev/templates

(The reason I made this post is that I was considering publishing a Dev Container Feature for installing micromamba, on rocker-org, but I thought that if mamba-org is interested in Dev Container it would obviously be more appropriate to be managed here.)

I am familiar with Dev Container Feature and Template publishing and may be able to help if needed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.