From 72c72f91c621d9dd2431eee01a28a4ca490588bc Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Sat, 8 Feb 2014 11:34:11 -0700 Subject: [PATCH] Swap Firefox to Iceweasel so that the Desktop Integration example is simplified and easier to understand Docker-DCO-1.1-Signed-off-by: Andrew Page (github: tianon) --- .../{README.txt => README.md} | 2 +- contrib/desktop-integration/data/Dockerfile | 20 ++++---- .../desktop-integration/firefox/Dockerfile | 49 ------------------- .../desktop-integration/iceweasel/Dockerfile | 41 ++++++++++++++++ 4 files changed, 52 insertions(+), 60 deletions(-) rename contrib/desktop-integration/{README.txt => README.md} (71%) delete mode 100644 contrib/desktop-integration/firefox/Dockerfile create mode 100644 contrib/desktop-integration/iceweasel/Dockerfile diff --git a/contrib/desktop-integration/README.txt b/contrib/desktop-integration/README.md similarity index 71% rename from contrib/desktop-integration/README.txt rename to contrib/desktop-integration/README.md index 2f55c979e3..02181a5f75 100644 --- a/contrib/desktop-integration/README.txt +++ b/contrib/desktop-integration/README.md @@ -8,4 +8,4 @@ Examples ======== * Data container: ./data/Dockerfile creates a data image sharing /data volume -* Firefox: ./firefox/Dockerfile shows a way to dockerize a common multimedia application +* Iceweasel: ./iceweasel/Dockerfile shows a way to dockerize a common multimedia application diff --git a/contrib/desktop-integration/data/Dockerfile b/contrib/desktop-integration/data/Dockerfile index 453afdd3d6..a9843a52ad 100644 --- a/contrib/desktop-integration/data/Dockerfile +++ b/contrib/desktop-integration/data/Dockerfile @@ -11,28 +11,28 @@ # # Build data image # docker build -t data -rm . # -# # Create a data container. (eg: firefox-data) -# docker run -name firefox-data data true +# # Create a data container. (eg: iceweasel-data) +# docker run -name iceweasel-data data true # # # List data from it -# docker run -volumes-from firefox-data busybox ls -al /data +# docker run -volumes-from iceweasel-data busybox ls -al /data docker-version 0.6.5 # Smallest base image, just to launch a container -from busybox -maintainer Daniel Mizyrycki +FROM busybox +MAINTAINER Daniel Mizyrycki # Create a regular user -run echo 'sysadmin:x:1000:1000::/data:/bin/sh' >> /etc/passwd -run echo 'sysadmin:x:1000:' >> /etc/group +RUN echo 'sysadmin:x:1000:1000::/data:/bin/sh' >> /etc/passwd +RUN echo 'sysadmin:x:1000:' >> /etc/group # Create directory for that user -run mkdir /data -run chown sysadmin.sysadmin /data +RUN mkdir /data +RUN chown sysadmin.sysadmin /data # Add content to /data. This will keep sysadmin ownership -run touch /data/init_volume +RUN touch /data/init_volume # Create /data volume VOLUME /data diff --git a/contrib/desktop-integration/firefox/Dockerfile b/contrib/desktop-integration/firefox/Dockerfile deleted file mode 100644 index f8924f4b4a..0000000000 --- a/contrib/desktop-integration/firefox/Dockerfile +++ /dev/null @@ -1,49 +0,0 @@ -# VERSION: 0.7 -# DESCRIPTION: Create firefox container with its dependencies -# AUTHOR: Daniel Mizyrycki -# COMMENTS: -# This file describes how to build a Firefox container with all -# dependencies installed. It uses native X11 unix socket and alsa -# sound devices. Tested on Debian 7.2 -# USAGE: -# # Download Firefox Dockerfile -# wget http://raw.github.com/dotcloud/docker/master/contrib/desktop-integration/firefox/Dockerfile -# -# # Build firefox image -# docker build -t firefox -rm . -# -# # Run stateful data-on-host firefox. For ephemeral, remove -v /data/firefox:/data -# docker run -v /data/firefox:/data -v /tmp/.X11-unix:/tmp/.X11-unix \ -# -v /dev/snd:/dev/snd -lxc-conf='lxc.cgroup.devices.allow = c 116:* rwm' \ -# -e DISPLAY=unix$DISPLAY firefox -# -# # To run stateful dockerized data containers -# docker run -volumes-from firefox-data -v /tmp/.X11-unix:/tmp/.X11-unix \ -# -v /dev/snd:/dev/snd -lxc-conf='lxc.cgroup.devices.allow = c 116:* rwm' \ -# -e DISPLAY=unix$DISPLAY firefox - -docker-version 0.6.5 - -# Base docker image -from tianon/debian:wheezy -maintainer Daniel Mizyrycki - -# Install firefox dependencies -run echo "deb http://ftp.debian.org/debian/ wheezy main contrib" > /etc/apt/sources.list -run apt-get update -run DEBIAN_FRONTEND=noninteractive apt-get install -y libXrender1 libasound2 \ - libdbus-glib-1-2 libgtk2.0-0 libpango1.0-0 libxt6 wget bzip2 sudo - -# Install Firefox -run mkdir /application -run cd /application; wget -O - \ - http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/25.0/linux-x86_64/en-US/firefox-25.0.tar.bz2 | tar jx - -# create sysadmin account -run useradd -m -d /data -p saIVpsc0EVTwA sysadmin -run sed -Ei 's/sudo:x:27:/sudo:x:27:sysadmin/' /etc/group -run sed -Ei 's/(\%sudo\s+ALL=\(ALL\:ALL\) )ALL/\1 NOPASSWD:ALL/' /etc/sudoers - -# Autorun firefox. -no-remote is necessary to create a new container, as firefox -# appears to communicate with itself through X11. -cmd ["/bin/sh", "-c", "/usr/bin/sudo -u sysadmin -H -E /application/firefox/firefox -no-remote"] diff --git a/contrib/desktop-integration/iceweasel/Dockerfile b/contrib/desktop-integration/iceweasel/Dockerfile new file mode 100644 index 0000000000..721cc6d2cf --- /dev/null +++ b/contrib/desktop-integration/iceweasel/Dockerfile @@ -0,0 +1,41 @@ +# VERSION: 0.7 +# DESCRIPTION: Create iceweasel container with its dependencies +# AUTHOR: Daniel Mizyrycki +# COMMENTS: +# This file describes how to build a Iceweasel container with all +# dependencies installed. It uses native X11 unix socket and alsa +# sound devices. Tested on Debian 7.2 +# USAGE: +# # Download Iceweasel Dockerfile +# wget http://raw.github.com/dotcloud/docker/master/contrib/desktop-integration/iceweasel/Dockerfile +# +# # Build iceweasel image +# docker build -t iceweasel -rm . +# +# # Run stateful data-on-host iceweasel. For ephemeral, remove -v /data/iceweasel:/data +# docker run -v /data/iceweasel:/data -v /tmp/.X11-unix:/tmp/.X11-unix \ +# -v /dev/snd:/dev/snd -lxc-conf='lxc.cgroup.devices.allow = c 116:* rwm' \ +# -e DISPLAY=unix$DISPLAY iceweasel +# +# # To run stateful dockerized data containers +# docker run -volumes-from iceweasel-data -v /tmp/.X11-unix:/tmp/.X11-unix \ +# -v /dev/snd:/dev/snd -lxc-conf='lxc.cgroup.devices.allow = c 116:* rwm' \ +# -e DISPLAY=unix$DISPLAY iceweasel + +docker-version 0.6.5 + +# Base docker image +FROM debian:wheezy +MAINTAINER Daniel Mizyrycki + +# Install Iceweasel and "sudo" +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq iceweasel sudo + +# create sysadmin account +RUN useradd -m -d /data -p saIVpsc0EVTwA sysadmin +RUN sed -Ei 's/sudo:x:27:/sudo:x:27:sysadmin/' /etc/group +RUN sed -Ei 's/(\%sudo\s+ALL=\(ALL\:ALL\) )ALL/\1 NOPASSWD:ALL/' /etc/sudoers + +# Autorun iceweasel. -no-remote is necessary to create a new container, as +# iceweasel appears to communicate with itself through X11. +CMD ["/usr/bin/sudo", "-u", "sysadmin", "-H", "-E", "/usr/bin/iceweasel", "-no-remote"]