Are there any downsides to using Conda inside Docker?

86 Views Asked by At

If I use Conda to manage my Python environment and packages, and want to replicate that in Docker, I can use Conda inside Docker. The continuumio/miniconda3 Docker image is about 400MB larger than Python-slim, but other than that, are there any real-world downsides/performance issues in running Conda inside Docker? (As opposed to installing packages in Docker via pip, Pipenv, etc.?)

1

There are 1 best solutions below

2
ypnos On

In general that works fine. It depends on what your goals are.

If you want to have a lean Python service container, you could use the official Python image from docker hub tagged with alpine, e.g. python3.12-alpine tag. Then use pip to install from requirements.txt or a Poetry-based project setup.

This will get you an even smaller image size than slim and typically work just as well.

However, if you want to replicate your Conda experience 1:1 your approach with Conda in Docker has its reasons: Conda binaries are built differently than regular Python wheels, e.g. it has its own version of Openblas, etc. with different optimizations.