mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
contrib: Desktop integration. Firefox usecase.
This commit is contained in:
parent
114e01cdc1
commit
5af87d1475
3 changed files with 98 additions and 0 deletions
11
contrib/desktop-integration/README.txt
Normal file
11
contrib/desktop-integration/README.txt
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
Desktop Integration
|
||||||
|
===================
|
||||||
|
|
||||||
|
The ./contrib/desktop-integration contains examples of typical dockerized
|
||||||
|
desktop applications.
|
||||||
|
|
||||||
|
Examples
|
||||||
|
========
|
||||||
|
|
||||||
|
* Data container: ./data/Dockerfile creates a data image sharing /data volume
|
||||||
|
* Firefox: ./firefox/Dockerfile shows a way to dockerize a common multimedia application
|
38
contrib/desktop-integration/data/Dockerfile
Normal file
38
contrib/desktop-integration/data/Dockerfile
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
# VERSION: 0.1
|
||||||
|
# DESCRIPTION: Create data image sharing /data volume
|
||||||
|
# AUTHOR: Daniel Mizyrycki <daniel@dotcloud.com>
|
||||||
|
# COMMENTS:
|
||||||
|
# This image is used as base for all data containers.
|
||||||
|
# /data volume is owned by sysadmin.
|
||||||
|
# USAGE:
|
||||||
|
# # Download data Dockerfile
|
||||||
|
# wget http://raw.github.com/dotcloud/docker/master/contrib/desktop-integration/data/Dockerfile
|
||||||
|
#
|
||||||
|
# # Build data image
|
||||||
|
# docker build -t data -rm .
|
||||||
|
#
|
||||||
|
# # Create a data container. (eg: firefox-data)
|
||||||
|
# docker run -name firefox-data data true
|
||||||
|
#
|
||||||
|
# # List data from it
|
||||||
|
# docker run -volumes-from firefox-data busybox ls -al /data
|
||||||
|
|
||||||
|
docker-version 0.6.5
|
||||||
|
|
||||||
|
# Smallest base image, just to launch a container
|
||||||
|
from busybox
|
||||||
|
maintainer Daniel Mizyrycki <daniel@docker.com>
|
||||||
|
|
||||||
|
# Create a regular user
|
||||||
|
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
|
||||||
|
|
||||||
|
# Add content to /data. This will keep sysadmin ownership
|
||||||
|
run touch /data/init_volume
|
||||||
|
|
||||||
|
# Create /data volume
|
||||||
|
VOLUME /data
|
49
contrib/desktop-integration/firefox/Dockerfile
Normal file
49
contrib/desktop-integration/firefox/Dockerfile
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
# VERSION: 0.7
|
||||||
|
# DESCRIPTION: Create firefox container with its dependencies
|
||||||
|
# AUTHOR: Daniel Mizyrycki <daniel@dotcloud.com>
|
||||||
|
# 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 <daniel@docker.com>
|
||||||
|
|
||||||
|
# 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"]
|
Loading…
Reference in a new issue