我正在尝试在 docker 容器内设置 conda 环境,但它总是在 dockerfile 中的环境创建阶段失败,并出现错误:
conda activate" fails because shell is not initialized
下面是我的 Dockerfile:
FROM pytorch/pytorch:1.1.0-cuda10.0-cudnn7.5-runtime
WORKDIR /app
# SET BASH AS CURRENT SHELL
RUN chsh -s /bin/bash
SHELL ["/bin/bash", "-c"]
# INSTALL ANACONDA
RUN apt-get update -y
RUN apt-get install -y wget && \
apt-get clean
RUN rm -rf /opt/conda && \
wget --quiet https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh -O ~/anaconda.sh && \
/bin/bash ~/anaconda.sh -b -p /opt/conda && \
rm ~/anaconda.sh && \
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \ …
Run Code Online (Sandbox Code Playgroud)