
Shrink your Conda Docker images with conda-pack - itamarst
https://pythonspeed.com/articles/conda-docker-image-size/
======
sterlinm
I've been doing a lot of research on this issue and I can't remember what it
was but I remember getting a few weird error messages with conda-pack. I've
found your articles at pythonspeed.com really useful, so I'm glad to see this
article. I've been exploring a few other options that I'd be interested to
hear your thoughts on. I'll explain them separately in replies to this
comment.

~~~
sterlinm
* conda-store * [https://github.com/Quansight/conda-store/](https://github.com/Quansight/conda-store/)

This one is really interesting, particularly for data science workloads. I
think it's not a good solution for serving applications, but really
interesting for things like JupyterHub, Dask, and Fargate.

The general idea is that you store your conda environments (the equivalent of
the /venv folder in your example) on an NFS drive (or EFS if you're on AWS).
Your containers then mount the network drive. This can help you a lot if you
want to build containerized development environments for data scientists. For
an application you can strip down your conda environment to the bare minimum
package set required to run your app, but if you want to containerize a
jupyter (or VS Code) development environment your users will likely want to
have 10-20 packages at the minimum. The package sets I've worked with often
lead to 3GB+ images if you're really aggressive about trying to keep it down.
The official jupyter/datascience-notebook image is 1.8GB compressed and 3.8GB
after the pull is finished.

conda-store is a component of the QHub project from Quansight. The
architecture diagram from that project might be of interest.
[https://github.com/Quansight/qhub/tree/master/architecture](https://github.com/Quansight/qhub/tree/master/architecture)

------
phuicy
Could it be smaller if you used alpine instead of debian?

~~~
itamarst
Yes. But the Alpine C library is musl, not glibc, and musl can sometimes be
incompatible with code compiled against glibc, so I don't like using it.

