From ac6ce38bf813657f97f024c97df0a032465db0f4 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Thu, 18 Sep 2014 08:33:51 +0200 Subject: [PATCH] new: [docker] new charm. This charms creates a docker LXC. Within this LXC, you can use docker commands. Note that this charm require LXC require privileges from apparmor to allow nested LXC. Last version of lxc-scripts is able to use the ``config`` file to add it the final LXC config file. --- precise/docker/config | 1 + precise/docker/hooks/install | 23 +++++++++++++++++++++++ precise/docker/hooks/start | 3 +++ precise/docker/hooks/stop | 3 +++ precise/docker/metadata.yaml | 8 ++++++++ precise/docker/revision | 1 + precise/docker/src/etc/default/docker | 15 +++++++++++++++ 7 files changed, 54 insertions(+) create mode 100644 precise/docker/config create mode 100755 precise/docker/hooks/install create mode 100755 precise/docker/hooks/start create mode 100755 precise/docker/hooks/stop create mode 100644 precise/docker/metadata.yaml create mode 100644 precise/docker/revision create mode 100644 precise/docker/src/etc/default/docker diff --git a/precise/docker/config b/precise/docker/config new file mode 100644 index 0000000..de6f698 --- /dev/null +++ b/precise/docker/config @@ -0,0 +1 @@ +lxc.aa_profile = unconfined diff --git a/precise/docker/hooks/install b/precise/docker/hooks/install new file mode 100755 index 0000000..a031f51 --- /dev/null +++ b/precise/docker/hooks/install @@ -0,0 +1,23 @@ +#!/bin/bash + +set -eux # -x for verbose logging to juju debug-log + + +## +## Install lxc, because docker can only work with lxc +## see: https://github.com/docker/docker/issues/6783 + +apt-get -y install lxc + +## +## Install docker +## + +curl https://get.docker.io | sh + +## +## Init.d and defaults running options +## + +cp src/etc/default/docker /etc/default/ + diff --git a/precise/docker/hooks/start b/precise/docker/hooks/start new file mode 100755 index 0000000..9eb7853 --- /dev/null +++ b/precise/docker/hooks/start @@ -0,0 +1,3 @@ +#!/bin/bash + +juju-log "Nothing to Start for base." diff --git a/precise/docker/hooks/stop b/precise/docker/hooks/stop new file mode 100755 index 0000000..170162b --- /dev/null +++ b/precise/docker/hooks/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +juju-log "Nothing to stop for base." diff --git a/precise/docker/metadata.yaml b/precise/docker/metadata.yaml new file mode 100644 index 0000000..b30bf82 --- /dev/null +++ b/precise/docker/metadata.yaml @@ -0,0 +1,8 @@ +name: docker +summary: "Docker Host" +maintainer: "Valentin Lab " +inherit: base-0k +description: | + Docker Host +data-resources: + - /var/lib/docker diff --git a/precise/docker/revision b/precise/docker/revision new file mode 100644 index 0000000..573541a --- /dev/null +++ b/precise/docker/revision @@ -0,0 +1 @@ +0 diff --git a/precise/docker/src/etc/default/docker b/precise/docker/src/etc/default/docker new file mode 100644 index 0000000..9ef7ce6 --- /dev/null +++ b/precise/docker/src/etc/default/docker @@ -0,0 +1,15 @@ +# Docker Upstart and SysVinit configuration file + +# Customize location of Docker binary (especially for development testing). +#DOCKER="/usr/local/bin/docker" + +# Use DOCKER_OPTS to modify the daemon startup options. +#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4" +DOCKER_OPTS="--exec-driver=lxc" + +# If you need Docker to use an HTTP proxy, it can also be specified here. +#export http_proxy="http://127.0.0.1:3128/" + +# This is also a handy place to tweak where Docker's temporary files go. +#export TMPDIR="/mnt/bigdrive/docker-tmp" +