Browse code

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 <admwiggin@gmail.com> (github: tianon)

Tianon Gravi authored on 2014/02/09 03:34:11
Showing 5 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,11 @@
0
+Desktop Integration
1
+===================
2
+
3
+The ./contrib/desktop-integration contains examples of typical dockerized
4
+desktop applications.
5
+
6
+Examples
7
+========
8
+
9
+* Data container: ./data/Dockerfile creates a data image sharing /data volume
10
+* Iceweasel: ./iceweasel/Dockerfile shows a way to dockerize a common multimedia application
0 11
deleted file mode 100644
... ...
@@ -1,11 +0,0 @@
1
-Desktop Integration
2
-===================
3
-
4
-The ./contrib/desktop-integration contains examples of typical dockerized
5
-desktop applications.
6
-
7
-Examples
8
-========
9
-
10
-* Data container: ./data/Dockerfile creates a data image sharing /data volume
11
-* Firefox: ./firefox/Dockerfile shows a way to dockerize a common multimedia application
... ...
@@ -11,28 +11,28 @@
11 11
 #   # Build data image
12 12
 #   docker build -t data -rm .
13 13
 #
14
-#   # Create a data container. (eg: firefox-data)
15
-#   docker run -name firefox-data data true
14
+#   # Create a data container. (eg: iceweasel-data)
15
+#   docker run -name iceweasel-data data true
16 16
 #
17 17
 #   # List data from it
18
-#   docker run -volumes-from firefox-data busybox ls -al /data
18
+#   docker run -volumes-from iceweasel-data busybox ls -al /data
19 19
 
20 20
 docker-version 0.6.5
21 21
 
22 22
 # Smallest base image, just to launch a container
23
-from busybox
24
-maintainer	Daniel Mizyrycki <daniel@docker.com>
23
+FROM busybox
24
+MAINTAINER Daniel Mizyrycki <daniel@docker.com>
25 25
 
26 26
 # Create a regular user
27
-run echo 'sysadmin:x:1000:1000::/data:/bin/sh' >> /etc/passwd
28
-run echo 'sysadmin:x:1000:' >> /etc/group
27
+RUN echo 'sysadmin:x:1000:1000::/data:/bin/sh' >> /etc/passwd
28
+RUN echo 'sysadmin:x:1000:' >> /etc/group
29 29
 
30 30
 # Create directory for that user
31
-run mkdir /data
32
-run chown sysadmin.sysadmin /data
31
+RUN mkdir /data
32
+RUN chown sysadmin.sysadmin /data
33 33
 
34 34
 # Add content to /data. This will keep sysadmin ownership
35
-run touch /data/init_volume
35
+RUN touch /data/init_volume
36 36
 
37 37
 # Create /data volume
38 38
 VOLUME /data
39 39
deleted file mode 100644
... ...
@@ -1,49 +0,0 @@
1
-# VERSION:        0.7
2
-# DESCRIPTION:    Create firefox container with its dependencies
3
-# AUTHOR:         Daniel Mizyrycki <daniel@dotcloud.com>
4
-# COMMENTS:
5
-#   This file describes how to build a Firefox container with all
6
-#   dependencies installed. It uses native X11 unix socket and alsa
7
-#   sound devices. Tested on Debian 7.2
8
-# USAGE:
9
-#   # Download Firefox Dockerfile
10
-#   wget http://raw.github.com/dotcloud/docker/master/contrib/desktop-integration/firefox/Dockerfile
11
-#
12
-#   # Build firefox image
13
-#   docker build -t firefox -rm .
14
-#
15
-#   # Run stateful data-on-host firefox. For ephemeral, remove -v /data/firefox:/data
16
-#   docker run -v /data/firefox:/data -v /tmp/.X11-unix:/tmp/.X11-unix \
17
-#     -v /dev/snd:/dev/snd -lxc-conf='lxc.cgroup.devices.allow = c 116:* rwm' \
18
-#     -e DISPLAY=unix$DISPLAY firefox
19
-#
20
-#   # To run stateful dockerized data containers
21
-#   docker run -volumes-from firefox-data -v /tmp/.X11-unix:/tmp/.X11-unix \
22
-#     -v /dev/snd:/dev/snd -lxc-conf='lxc.cgroup.devices.allow = c 116:* rwm' \
23
-#     -e DISPLAY=unix$DISPLAY firefox
24
-
25
-docker-version 0.6.5
26
-
27
-# Base docker image
28
-from tianon/debian:wheezy
29
-maintainer	Daniel Mizyrycki <daniel@docker.com>
30
-
31
-# Install firefox dependencies
32
-run echo "deb http://ftp.debian.org/debian/ wheezy main contrib" > /etc/apt/sources.list
33
-run apt-get update
34
-run DEBIAN_FRONTEND=noninteractive apt-get install -y libXrender1 libasound2 \
35
-    libdbus-glib-1-2 libgtk2.0-0 libpango1.0-0 libxt6 wget bzip2 sudo
36
-
37
-# Install Firefox
38
-run mkdir /application
39
-run cd /application; wget -O - \
40
-    http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/25.0/linux-x86_64/en-US/firefox-25.0.tar.bz2 | tar jx
41
-
42
-# create sysadmin account
43
-run useradd -m -d /data -p saIVpsc0EVTwA sysadmin
44
-run sed -Ei 's/sudo:x:27:/sudo:x:27:sysadmin/' /etc/group
45
-run sed -Ei 's/(\%sudo\s+ALL=\(ALL\:ALL\) )ALL/\1 NOPASSWD:ALL/' /etc/sudoers
46
-
47
-# Autorun firefox. -no-remote is necessary to create a new container, as firefox
48
-# appears to communicate with itself through X11.
49
-cmd ["/bin/sh", "-c", "/usr/bin/sudo -u sysadmin -H -E /application/firefox/firefox -no-remote"]
50 1
new file mode 100644
... ...
@@ -0,0 +1,41 @@
0
+# VERSION:        0.7
1
+# DESCRIPTION:    Create iceweasel container with its dependencies
2
+# AUTHOR:         Daniel Mizyrycki <daniel@dotcloud.com>
3
+# COMMENTS:
4
+#   This file describes how to build a Iceweasel container with all
5
+#   dependencies installed. It uses native X11 unix socket and alsa
6
+#   sound devices. Tested on Debian 7.2
7
+# USAGE:
8
+#   # Download Iceweasel Dockerfile
9
+#   wget http://raw.github.com/dotcloud/docker/master/contrib/desktop-integration/iceweasel/Dockerfile
10
+#
11
+#   # Build iceweasel image
12
+#   docker build -t iceweasel -rm .
13
+#
14
+#   # Run stateful data-on-host iceweasel. For ephemeral, remove -v /data/iceweasel:/data
15
+#   docker run -v /data/iceweasel:/data -v /tmp/.X11-unix:/tmp/.X11-unix \
16
+#     -v /dev/snd:/dev/snd -lxc-conf='lxc.cgroup.devices.allow = c 116:* rwm' \
17
+#     -e DISPLAY=unix$DISPLAY iceweasel
18
+#
19
+#   # To run stateful dockerized data containers
20
+#   docker run -volumes-from iceweasel-data -v /tmp/.X11-unix:/tmp/.X11-unix \
21
+#     -v /dev/snd:/dev/snd -lxc-conf='lxc.cgroup.devices.allow = c 116:* rwm' \
22
+#     -e DISPLAY=unix$DISPLAY iceweasel
23
+
24
+docker-version 0.6.5
25
+
26
+# Base docker image
27
+FROM debian:wheezy
28
+MAINTAINER Daniel Mizyrycki <daniel@docker.com>
29
+
30
+# Install Iceweasel and "sudo"
31
+RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq iceweasel sudo
32
+
33
+# create sysadmin account
34
+RUN useradd -m -d /data -p saIVpsc0EVTwA sysadmin
35
+RUN sed -Ei 's/sudo:x:27:/sudo:x:27:sysadmin/' /etc/group
36
+RUN sed -Ei 's/(\%sudo\s+ALL=\(ALL\:ALL\) )ALL/\1 NOPASSWD:ALL/' /etc/sudoers
37
+
38
+# Autorun iceweasel. -no-remote is necessary to create a new container, as
39
+# iceweasel appears to communicate with itself through X11.
40
+CMD ["/usr/bin/sudo", "-u", "sysadmin", "-H", "-E", "/usr/bin/iceweasel", "-no-remote"]