【问题标题】:Permission Denied docker Mac Os M1权限被拒绝 docker Mac Os M1
【发布时间】:2021-01-27 01:32:18
【问题描述】:

我对 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] 时,我不断收到“Permission Denied”错误。这是它的样子:

/bin/sh: 1: /src/startup: Permission denied

谁能帮我解决这个问题?我有一个 Mac OS,我有新 M1 芯片的 docker 预览版。

【问题讨论】:

  • 你在/src/setup上设置了执行位吗?
  • 我想是的。每个文件都应该有权限。 -rw-r--r--@ 1 nidhigthite 员工 1335 Jan 26 18:21 Dockerfile -rw-r--r--@ 1 nidhigthite 员工 1324 Jan 25 10:55 jupyter_notebook_config.py -rwxrwxrwx@ 1 nidhigthite 员工 253 Jan 25 10:55 开机
  • 如果你ENV LD_LIBRARY_PATH /usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH而不是反斜杠会发生什么?
  • 成功了!谢谢。

标签: python macos docker tensorflow jupyter-notebook


【解决方案1】:

来自 cmets,工作代码如下所示

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)

【讨论】:

    猜你喜欢
    • 2012-06-03
    • 2023-03-22
    • 2015-01-11
    • 1970-01-01
    • 2020-11-25
    • 2020-08-31
    • 2021-11-05
    • 2012-03-22
    • 2021-09-04
    相关资源
    最近更新 更多