首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在访问Docker中的文件时获得权限拒绝错误

在访问Docker中的文件时获得权限拒绝错误
EN

Stack Overflow用户
提问于 2019-08-06 14:01:47
回答 1查看 818关注 0票数 0

我试图在AWS Sagemaker上部署一个模型,并使用以下docker文件:

代码语言:javascript
复制
FROM ubuntu:16.04

#MAINTAINER Amazon AI <sage-learner@amazon.com>


RUN apt-get -y update && apt-get install -y --no-install-recommends \
 wget \
 python3.5-dev \
 gcc \
 nginx \
 ca-certificates \
 libgcc-5-dev \
 && rm -rf /var/lib/apt/lists/*

# Here we get all python packages.
# There's substantial overlap between scipy and numpy that we eliminate by
# linking them together. Likewise, pip leaves the install caches populated which uses
# a significant amount of space. These optimizations save a fair amount of space in the
# image, which reduces start up time.
RUN wget https://bootstrap.pypa.io/3.3/get-pip.py && python3.5 get-pip.py && \
    pip3 install numpy==1.14.3 scipy lightfm scikit-optimize pandas==0.22.0 flask gevent gunicorn && \
    rm -rf /root/.cache

# Set some environment variables. PYTHONUNBUFFERED keeps Python from buffering our standard
# output stream, which means that logs can be delivered to the user quickly. PYTHONDONTWRITEBYTECODE
# keeps Python from writing the .pyc files which are unnecessary in this case. We also update
# PATH so that the train and serve programs are found when the container is invoked.

ENV PYTHONUNBUFFERED=TRUE
ENV PYTHONDONTWRITEBYTECODE=TRUE
ENV PATH="/opt/program:${PATH}"

# Set up the program in the image
COPY lightfm /opt/program
WORKDIR /opt/program

成功构建了对接容器,但是当我编写以下命令时:

代码语言:javascript
复制
docker run XYZ train

在我的本地,甚至在Sagemaker上,我得到了以下错误:

代码语言:javascript
复制
standard_init_linux.go:207: exec user process caused "permission denied"

在docker文件中,我正在复制一个名为Lightfm的文件夹,其中有一个名为"train“的文件。

有人能帮忙吗?

我的DOCKER构建的输出:

代码语言:javascript
复制
$ docker build -t lightfm .
Sending build context to Docker daemon  41.47kB
Step 1/9 : FROM ubuntu:16.04
 ---> 5e13f8dd4c1a
Step 2/9 : RUN apt-get -y update && apt-get install -y --no-install-recommends  wget  python3.5-dev  gcc  nginx  ca-certificates  libgcc-5-dev  && rm -rf /var/lib/apt/lists/*
 ---> Using cache
 ---> 14ae3a1eb780
Step 3/9 : RUN wget https://bootstrap.pypa.io/3.3/get-pip.py && python3.5 get-pip.py &&     pip3 install numpy==1.14.3 scipy lightfm scikit-optimize pandas==0.22.0 flask gevent gunicorn &&     rm -rf /root/.cache
 ---> Using cache
 ---> 5a2727e27385
Step 4/9 : ENV PYTHONUNBUFFERED=TRUE
 ---> Using cache
 ---> 43bf8c5e8414
Step 5/9 : ENV PYTHONDONTWRITEBYTECODE=TRUE
 ---> Using cache
 ---> 7d2c45d61cec
Step 6/9 : ENV PATH="/opt/program:${PATH}"
 ---> Using cache
 ---> f3cc6313c0d9
Step 7/9 : COPY lightfm /opt/program
 ---> ad929ba84692
Step 8/9 : WORKDIR /opt/program
 ---> Running in a040dd0bab03
Removing intermediate container a040dd0bab03
 ---> 8f53c5a3ba63
Step 9/9 : RUN chmod 755 serve
 ---> Running in 5666abb27cd0
Removing intermediate container 5666abb27cd0
 ---> e80aca934840
Successfully built e80aca934840
Successfully tagged lightfm:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
EN

回答 1

Stack Overflow用户

发布于 2019-08-06 15:48:53

假设train是您想要运行的可执行文件,则授予它exec权限。在COPY lightfm /opt/program行之后,添加RUN chmod +x /opt/program/train

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57377852

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档