wbq220116
wang.boquan
2017-07-04 06:29
采纳率: 50%
浏览 13.3k

Dockerfile中的权限问题

参考这篇博客Running GUI apps with Docker,试图使用dockerfile构建一个可以运行一个编译安装的gui程序,执行到RUN chmod +x configure时报错

chmod: cannot access 'configure': Permission denied

Dockerfile文件如下

FROM ubuntu:14.04

ENV DEBIAN_FRONTEND noninteractive

RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak
RUN sed -i s:/archive.ubuntu.com:/mirrors.aliyun.com/ubuntu:g /etc/apt/sources.list
RUN cat /etc/apt/sources.list
RUN apt-get clean
RUN apt-get update --fix-missing
RUN apt-get install -y --no-install-recommends --allow-unauthenticated \
        freeglut3-dev libplib-dev libopenal-dev libalut-dev \
        libvorbis-dev libxi-dev libxmu-dev libxrender-dev libxrandr-dev \
        libxrandr-dev build-essential libpng-dev libopencv-dev \
    && apt-get autoclean \
    && apt-get autoremove \
    && rm -rf /var/lib/apt/lists/*

RUN export uid=1000 gid=1000 && \
    mkdir -p /home/developer && \
    echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \
    echo "developer:x:${uid}:" >> /etc/group && \
    echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \
    chmod 0440 /etc/sudoers.d/developer && \
    chown ${uid}:${gid} -R /home/developer

USER developer

ADD image /

WORKDIR /home/developer/project/src/torcs
RUN chmod +x configure
RUN ./configure --prefix=/home/developer/project/install -enable-debug --enable-profiler
RUN make 
RUN make install 
RUN make datainstall

ENV HOME /home/developer
CMD /home/developer/project/install/bin/torcs

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • wbq220116
    wang.boquan 2017-07-04 06:50
    已采纳

    emmmm刚发出去没几分钟自己就解决了有点尴尬

    USER developer前增加RUN chmod 777 /home/developer然后该sudo的地方sudo就好了

    点赞 评论

相关推荐