-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set up a Docker image using conda or mamba #5
Comments
You can take inspiration from the Docker image I'm using for my day-to-day development for few years now: diegoferigo/development-iit@Conda. In particular, these lines create a default environment with The main trick to enable the environment in the rest of the Dockerfile (and I mean, in the build stage) is the combination of:
With this trick, every |
To include also alumnis, I guess also @prashanthr05 may have useful pointers. |
I have used what @traversaro has already mentioned in #5 (comment) as a reference to run conda and Docker and additionally took a lot of inspiration from @diegoferigo's repository https://github.com/diegoferigo/development-iit and @GiulioRomualdi's repository https://github.com/ami-iit/paper_romualdi_2022_icra_centroidal-mpc-walking to install all the necessary robotology-superbuild based dependencies using conda and self-activated conda environment at every docker run in https://github.com/ami-iit/paper_ramadoss_2022_humanoids_human-base-estimation. But while cleaning up the conda installation for slimming down the images, it is better to keep an eye on what are we deleting to keep the image light, see issue prashanthr05/sample-docker-conda-cpp-project#1 (comment). Some other useful resources to read through to keep images small, reduce build times, and an ounce of security while using Docker containers are mentioned in the following articles, |
C.C. @mebbaid |
This seems to be important for many in @ami-iit/artificial-mechanical-intelligence dealing with Docker |
With @GiulioRomualdi and @CarlottaSartore, we had the doubt of the proper way of setting up a Docker image in a way that new commands "saw" the environment. Initially we followed https://pythonspeed.com/articles/activate-conda-dockerfile/, but the suggestion of using
conda run
was problematic as anyCOMMAND
statement needed to be prefixed byconda run
.So, I think instead a good source of inspiration may be https://github.com/conda-forge/miniforge-images, that contains the Dockerfiles for the images published for example in https://hub.docker.com/r/condaforge/mambaforge . If feasible, it can make sense to use
condaforge/mambaforge
as a base image, while if that is not possible and you want to install conda/mamba manually it is a good idea to check how they do it in https://github.com/conda-forge/miniforge-images/blob/master/ubuntu/Dockerfile:It seems that the script is quite self-explanatory, in particular that in the activation script
conda activate base
should be prefixed by. ${CONDA_DIR}/etc/profile.d/conda.sh &&
.Once you have something that is working and you want to reduce its size, you can also check https://jcristharif.com/conda-docker-tips.html for additional tricks.
The text was updated successfully, but these errors were encountered: