我对 docker 非常陌生,我一直遇到“权限被拒绝”的问题。我能够使用以下 docker 文件构建图像:
FROM tensorflow/tensorflow:latest
ENV DEBIAN_FRONTEND=noninteractive
# Python
RUN apt-get update -y && apt-get upgrade -y &&\
apt-get install python-opencv -y &&\
pip install -U pip setuptools
RUN pip install keras jupyter && \
pip install ipdb pytest pytest-cov python-coveralls coverage==3.7.1 pytest-xdist pep8 pytest-pep8 pydot_ng jupyter && \
pip install Pillow scikit-learn notebook matplotlib nose pyyaml six h5py pandas scikit-image python-resize-image glob2 && \
pip install opencv-python && \
pip install --upgrade tensorflow-gpu tensorflow-probability
# COPY ST2inJupyter.js ~/.jupyter/custom/custom.js #this does not work. put explicit abs path on image (abs path for files in directories outside Dockerfile do not work currently)
# Set up our notebook config.
COPY jupyter_notebook_config.py /root/.jupyter/
ADD startup /src/startup
ENV PYTHONPATH='/src/:$PYTHONPATH'
WORKDIR /src
#Configure Jupyter notebook port exposure
EXPOSE 8888
# For CUDA profiling, TensorFlow requires CUPTI.
ENV LD_LIBRARY_PATH \usr\local\cuda\extras\CUPTI\lib64:$LD_LIBRARY_PATH
# TensorBoard (only needed for visualizing lower level TF models. in keras, not really too helpful, but just keep in)
EXPOSE 6006
# Define startup bash script in external file (loaded via ADD or COPY above)
CMD /src/startup
当我运行 docker 镜像:docker run -v ${PWD}:/src/hostpwd -it -p 8888:8888 [image_name]
时,我一直收到“权限被拒绝”错误。这是它的样子:
/bin/sh: 1: /src/startup: Permission denied
谁能帮我解决这个问题?我有一个 Mac 操作系统,我有新 M1 芯片的 docker 预览版。
答案 0 :(得分:0)
来自评论,工作代码如下
FROM tensorflow/tensorflow:latest
ENV DEBIAN_FRONTEND=noninteractive
# Python
RUN apt-get update -y && apt-get upgrade -y &&\
apt-get install python-opencv -y &&\
pip install -U pip setuptools
RUN pip install keras jupyter && \
pip install ipdb pytest pytest-cov python-coveralls coverage==3.7.1 pytest-xdist pep8 pytest-pep8 pydot_ng jupyter && \
pip install Pillow scikit-learn notebook matplotlib nose pyyaml six h5py pandas scikit-image python-resize-image glob2 && \
pip install opencv-python && \
pip install --upgrade tensorflow-gpu tensorflow-probability
# COPY ST2inJupyter.js ~/.jupyter/custom/custom.js #this does not work. put explicit abs path on image (abs path for files in directories outside Dockerfile do not work currently)
# Set up our notebook config.
COPY jupyter_notebook_config.py /root/.jupyter/
ADD startup /src/startup
ENV PYTHONPATH='/src/:$PYTHONPATH'
WORKDIR /src
#Configure Jupyter notebook port exposure
EXPOSE 8888
# For CUDA profiling, TensorFlow requires CUPTI.
ENV LD_LIBRARY_PATH /usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH
# TensorBoard (only needed for visualizing lower level TF models. in keras, not really too helpful, but just keep in)
EXPOSE 6006
# Define startup bash script in external file (loaded via ADD or COPY above)
CMD /src/startup
(转自 chepner)