~brianlbaird/charms/trusty/pgw/trunk

1 by brianlbaird at gmail
update pgw relation in metadata
1
# Charm Layer for Docker
2
3
This repository contains the Charm layer for docker, which can be used as a
4
base layer for other Charms that use docker.  Please refer to the
5
[Juju composer docs](https://jujucharms.com/docs/devel/authors-charm-composing).
6
7
## Usage
8
9
In a charm that wants to use docker, the integration can be as simple as placing
10
the following in your charm's `compose.yaml`:
11
12
    includes: ['layer:docker']
13
14
From here, you simply amend any hooks/reactive patterns you require to deliver
15
and manage the lifecycle of your applications docker image.
16
17
### States
18
19
The docker layer raises a few synthetic events:
20
21
- docker.ready
22
23
- docker.available
24
25
##### docker.ready
26
27
When docker.ready is set, this event is before we signify to other
28
layers that we are ready to start workloads, which should allow for
29
docker extensions to be installed free of disrupting active workloads.
30
31
For example, installing SDN support and getting the daemon configured
32
for TCP connections.
33
34
```
35
@when('docker.ready')
36
def start_flannel_networking():
37
    # do something here
38
```
39
40
##### docker.available
41
42
When docker.available is set, the daemon is considered fully configured
43
and ready to accept workloads.
44
45
```
46
@when('docker.available')
47
def start_my_workload():
48
    # do something with docker
49
```
50
51
### Docker Compose
52
53
 This layer installs the 'docker-compose' python package from pypi. So
54
once the Docker layer is installed you have the ability to use [Docker
55
Compose](https://docs.docker.com/compose/) functionality such as control files,
56
and logging.
57
58
### Memory Accounting
59
The charm supports altering the GRUB2 options enabling CGROUPS and memory
60
accounting. Changing this value will reboot the host, and any running workloads
61
are at the mercy of the charm author inheriting from this charm. Please use
62
`--restart=always` on your container runs that need to be persistent.
63
64
### charms.docker
65
66
This layer also includes a wheelhouse of `charms.docker` a python library to make
67
charming with docker, and configuring the docker daemon much easier, and syntactically
68
enjoyable. For more information about this library see the [project](http://github.com/juju-solutions/charms.docker)
69
70
## Credit
71
72
This charm contains a slightly modified copy of the script contained at:
73
[https://get.docker.io](https://get.docker.io)
74
75
The modifications were raising status messages for Juju so its apparent what is
76
happening to the end user following along with Juju's extended status feature.