我对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,还有新M1芯片的预览版docker。
发布于 2021-03-19 23:34:20
从注释,如下所示的工作代码
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)
https://stackoverflow.com/questions/65911683
复制相似问题