summaryrefslogtreecommitdiff
path: root/src/Propellor/Property
diff options
context:
space:
mode:
authorJoey Hess2014-10-23 11:26:05 -0400
committerJoey Hess2014-10-23 11:26:05 -0400
commit80f5b53f1b7fdc876d5e45df68c29f53bd9666b2 (patch)
tree9bddbad55023e4ed890562e509f8e06f5bdbae2f /src/Propellor/Property
parent5bfeb3f9aad1108907544deb0b04ccc58b5614c0 (diff)
propellor spin
Diffstat (limited to 'src/Propellor/Property')
-rw-r--r--src/Propellor/Property/Docker.hs30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs
index b717fe19..de3c64fb 100644
--- a/src/Propellor/Property/Docker.hs
+++ b/src/Propellor/Property/Docker.hs
@@ -19,6 +19,7 @@ module Propellor.Property.Docker (
-- * Container configuration
dns,
hostname,
+ name,
publish,
expose,
user,
@@ -155,15 +156,12 @@ mkContainer cid@(ContainerId hn _cn) h = Container
where
info = _dockerinfo $ hostInfo h'
h' = h
- -- Restart by default so container comes up on
- -- boot or when docker is upgraded.
- &^ restart RestartAlways
- -- Expose propellor directory inside the container.
+ -- expose propellor directory inside the container
& volume (localdir++":"++localdir)
- -- Name the container in a predictable way so we
- -- and the user can easily find it later. This property
- -- comes last, so it cannot be overridden.
+ -- name the container in a predictable way so we
+ -- and the user can easily find it later
& name (fromContainerId cid)
+ & restart RestartAlways
-- | Causes *any* docker images that are not in use by running containers to
-- be deleted. And deletes any containers that propellor has set up
@@ -222,7 +220,7 @@ dns = runProp "dns"
hostname :: String -> Property
hostname = runProp "hostname"
--- | Set name of container.
+-- | Set name for container. (Normally done automatically.)
name :: String -> Property
name = runProp "name"
@@ -285,19 +283,19 @@ restart policy = runProp "restart" (serialize policy)
where
serialize NoRestart = "no"
serialize (RestartOnFailure Nothing) = "on-failure"
- serialize (RestartOnFailure (Just n)) = "on-failure:" ++ show n
+ serialize (RestartOnFailure n) = "on-failure:" ++ show n
serialize RestartAlways = "always"
--- | RestartAlways is the default for docker containers configured by
--- propellor; as well as keeping badly behaved containers running,
--- it ensures that containers get started back up after reboot or
--- after docker is upgraded.
---
--- NoRestart makes docker not restart a container when it exits
+-- | NoRestart makes docker not restart a container when it exits
-- Note that this includes not restarting it on boot!
--
-- RestartOnFailure will restart the container if it exits nonzero.
--- A max-retry value can be provided to prevent too many restarts.
+-- A max-retry value can be provided to prevent repeated restarts.
+--
+-- RestartAlways is the default for docker containers configured by
+-- propellor; as well as keeping badly behaved containers running,
+-- it ensures that containers get started back up after reboot or
+-- after docker is upgraded.
data RestartPolicy = NoRestart | RestartOnFailure (Maybe Int) | RestartAlways
-- | A container is identified by its name, and the host