作者 主題: a Sample DockerFile  (閱讀 867 次)

0 會員 與 1 訪客 正在閱讀本文。

netman

  • 管理員
  • 俺是博士!
  • *****
  • 文章數: 17292
    • 檢視個人資料
    • http://www.study-area.org
a Sample DockerFile
« 於: 2014-12-31 16:11 »
代碼: [選擇]
FROM ubuntu:14.04

RUN apt-get update && apt-get install -y firefox

# Replace 1000 with your user / group id
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
ENV HOME /home/developer
CMD /usr/bin/firefox

save it in current directory.
then...

docker build -t firefox .
docker run -ti --rm  -e DISPLAY=$DISPLAY   -v /tmp/.X11-unix:/tmp/.X11-unix firefox

Ref:
http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/