我对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 usrlocalcudaextrasCUPTIlib64:$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 image:docker run -v ${PWD}:/src/hostpwd -it -p 8888:8888 [image_name]
时,我一直得到"拒绝许可";错误。如下图所示:
/bin/sh: 1: /src/startup: Permission denied
从注释中,工作代码如下所示
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
(转述自彻普纳)