Activate conda env and run pip install requirements in the Dockfile

Viewed 756

I can create my virtual environment dev1 successfully, but I can not activate it and switch into in during the Docker building.

All I want is to switch the venv and install my dependencies in requirements.txt.

My code:

WORKDIR /APP
ADD . /APP
ARG CONDA_VENV=dev1
RUN conda create -y --name ${CONDA_VENV} python=3.7
RUN conda activate ${CONDA_VENV}
RUN pip install -r requirements.txt

Error:

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

See 'conda init --help' for more information and options.

IMPORTANT: You may need to close and restart your shell after running 'conda init'.


The command '/bin/sh -c conda activate ${CONDA_VENV}' returned a non-zero code: 1
0 Answers
Related