I have one Dockerfile that looks like this:
FROM python:3.10.9
COPY ./env.yml .
RUN apt-get update && \
apt-get install -y wget bzip2 && \
wget -q https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh -O /tmp/anaconda.sh && \
/bin/bash /tmp/anaconda.sh -b -p /opt/conda && \
rm /tmp/anaconda.sh \
conda env create -f env.yml
CMD ["conda", "activate", "env"]
Let's call this Docker A. We build it as such: docker build -t docker_a -f ./docker_a.dockerfile .
.
Another Dockerfile that we'll call Docker B look like this:
FROM docker_a:latest
COPY ./file1.json ./file2.csv ./run_script.sh ./
RUN conda activate env
CMD ["run_script.sh", "1"]
When I run this I get a /bin/sh: 1: conda: not found
error. I figure that the virtual environment I created in Docker A isn't being properly propagated to Docker B.
How do I connect the two?
For some context, I'll be using several Docker images like these inside of a KubeFlow Pipeline.