![错误:“命令 '/bin/sh -c source protected-env/bin/activate' 返回非零代码:127”当我尝试配置我的第一个 dockerfile 时](https://linux22.com/image/1022832/%E9%94%99%E8%AF%AF%EF%BC%9A%E2%80%9C%E5%91%BD%E4%BB%A4%20'%2Fbin%2Fsh%20-c%20source%20protected-env%2Fbin%2Factivate'%20%E8%BF%94%E5%9B%9E%E9%9D%9E%E9%9B%B6%E4%BB%A3%E7%A0%81%EF%BC%9A127%E2%80%9D%E5%BD%93%E6%88%91%E5%B0%9D%E8%AF%95%E9%85%8D%E7%BD%AE%E6%88%91%E7%9A%84%E7%AC%AC%E4%B8%80%E4%B8%AA%20dockerfile%20%E6%97%B6.png)
我正在尝试学习docker。这是我的第一次实验。我写了这个dockerfile:
FROM nvidia/cudagl:11.3.0-base-ubuntu20.04
LABEL Author="ZioMario"
LABEL Title="Firefox/Docker20.10.6/Ubuntu20.04"
# Enviorment variables
ENV DEBIAN_FRONTEND noninteractive
ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8
ENV PATH "$PATH:/bin/2.82/python/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
ENV FIREFOX_PATH "/bin/2.82"
ENV FIREFOXPIP "/bin/2.82/python/bin/pip3"
ENV FIREFOXPY "/bin/2.82/python/bin/python3.7m"
ENV HW="GPU"
# Install dependencies
RUN apt-get update && apt-get install -y \
apt-utils \
wget \
libopenexr-dev \
bzip2 \
build-essential \
zlib1g-dev \
libxmu-dev \
libxi-dev \
libxxf86vm-dev \
libfontconfig1 \
libxrender1 \
libgl1-mesa-glx \
xz-utils \
firefox \
openjdk-8-jre
# Download the Python source
RUN wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz \
&& tar -xzf Python-3.7.0.tgz \
&& cp -r Python-3.7.0/Include/* $FIREFOX_PATH/python/include/python3.7m/ \
&& rm -rf Python-3.7.0.tgz \
&& rm -rf Python-3.7.0
# Installing a modern version of numpy
RUN rm -rf ${FIREFOX_PATH}/python/lib/python3.7/site-packages/numpy
# Must first ensurepip to install Firefox pip3 and then new numpy
RUN ${FIREFOXPY} -m venv protected-env
RUN source protected-env/bin/activate
RUN ${FIREFOXPY} -m ensurepip && ${FIREFOXPIP} install --upgrade pip && ${FIREFOXPIP} install numpy
RUN deactivate
# Set the working directory
WORKDIR /
不幸的是它不起作用。这是我收到的错误:
命令 '/bin/sh -c source protected-env/bin/activate' 返回非零代码:127
错误的一行是这样的:
运行源 protected-env/bin/activate
您知道如何修复它吗?谢谢。