summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Docker.hs
diff options
context:
space:
mode:
authorJoey Hess2014-10-23 03:27:40 -0400
committerJoey Hess2014-10-23 03:27:40 -0400
commit856a4c673cc890b1e2e5ee749bdc70ea6d7f1cb9 (patch)
treeef7bac9df90a885278e0b61af19a91654c946c62 /src/Propellor/Property/Docker.hs
parent93099b862768235d3f9936435f6f65292b8d9b7c (diff)
propellor spin
Diffstat (limited to 'src/Propellor/Property/Docker.hs')
-rw-r--r--src/Propellor/Property/Docker.hs22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs
index 358cc8c3..b717fe19 100644
--- a/src/Propellor/Property/Docker.hs
+++ b/src/Propellor/Property/Docker.hs
@@ -19,7 +19,6 @@ module Propellor.Property.Docker (
-- * Container configuration
dns,
hostname,
- name,
publish,
expose,
user,
@@ -156,10 +155,14 @@ mkContainer cid@(ContainerId hn _cn) h = Container
where
info = _dockerinfo $ hostInfo h'
h' = h
- -- expose propellor directory inside the container
+ -- Restart by default so container comes up on
+ -- boot or when docker is upgraded.
+ &^ restart RestartAlways
+ -- 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
+ -- 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 (fromContainerId cid)
-- | Causes *any* docker images that are not in use by running containers to
@@ -219,7 +222,7 @@ dns = runProp "dns"
hostname :: String -> Property
hostname = runProp "hostname"
--- | Set name for container. (Normally done automatically.)
+-- | Set name of container.
name :: String -> Property
name = runProp "name"
@@ -382,14 +385,7 @@ runningContainer cid@(ContainerId hn cn) image runps = containerDesc cid $ prope
shim <- liftIO $ Shim.setup (localdir </> "propellor") (localdir </> shimdir cid)
liftIO $ writeFile (identFile cid) (show ident)
ensureProperty $ boolProperty "run" $ runContainer img
- -- Restart by default so container comes up on
- -- boot or when docker is upgraded. This is put
- -- here, rather than adding a default Property
- -- in mkContainer, to avoid changing the ident
- -- of existing containers. Any restart property
- -- will override it.
- -- This is a hack. TODO: Move to correct place.
- ("--restart=always" : runps ++ ["-i", "-d", "-t"])
+ (runps ++ ["-i", "-d", "-t"])
[shim, "--docker", fromContainerId cid]
-- | Called when propellor is running inside a docker container.