I use anaconda environments and install everything with pip in them. Am I doing it wrong?
Today, I manage python via pyenv (local and global state) that let's me create infinite .venvs with different python versions.
COPY conda.yaml /env/conda.yaml
RUN conda env create -f /env/conda.yaml -p /env/conda
COPY foo.py /env/foo.py
CMD ["/env/conda/bin/python", "/env/foo.py"]
What is a little funny is installing a consistent version of Conda inside a container, because the official Miniconda installers are rolling-release only. However you might be able to downgrade to your desired version of Conda after installation.