```FROM continuumio/miniconda3 RUN mkdir dockerfi...
# ask-metaflow
a
Copy code
FROM continuumio/miniconda3

RUN mkdir dockerfiles
COPY dockerfiles ./dockerfiles
WORKDIR /dockerfiles

RUN conda create -n base_env python=3.8

RUN /bin/bash -c "source activate base_env && pip install -r dependency.txt"

RUN echo "conda activate base_env" >> ~/.bashrc
ENV PATH /opt/conda/envs/env/bin:$PATH
1
cc @late-telephone-2729
a
do you see numpy if you run the container locally?
a
@ancient-application-36103 yes, we can import numpy once logged into docker container
a
if you do
which python
inside the container - does it point to the same conda environment?
l
/opt/conda/envs/base_env/bin/python
is what we see. Looks like the
base_env
is the activated one
version = 'Python 3.8.16'
We are using the image in the step level
Copy code
@batch(cpu=1, image=COMMON_CONDA_BASE_IMAGE)
a
and if you do
which python
within your step code before the call to import numpy, what do you see there?
a
Copy code
/opt/conda/bin/python
@ancient-application-36103 here is what I got, it looks the activated conda env is not used in actual run for some reason, how can I activate my conda env?
a
Copy code
RUN conda activate base_env
should do the trick
a
I think I have
conda activate base_env
in my dockerfile, it should be automatically activated
why is my activated env not used in actual run?
a
I don't think bashrc is sourced by the cmd by default
a
ok, let us retry it, will let you know how it goes. @late-telephone-2729 can you update the second line from last and retry docker image build process?
a
it works locally since your login shell is bash
a
yup, that's likely. we will test new docker image tomorrow. thanks for the hint!