Problem Statement::

If a user calls:

RUN conda env create -f environment.yml

or

RUN conda env create -f requirements.txt

or

RUN conda env create -f pyproject.toml

and then calls

RUN conda activate my_env

as they should the next call to RUN, for example on like this::

RUN python -c "import flask”

Which depends on the my_env conda environment, will fail because each call to RUN by the docker file has its own memory context.

The call to::

RUN conda activate my_env 

has a separate memory context than

RUN python -c “import flask”  

What’s the solution?