From 7637ea0af9ff4056cbdc16f25016785442d4b97e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 23 Oct 2014 11:23:25 -0400 Subject: propellor spin --- src/Propellor/Property/Docker.hs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/Propellor/Property/Docker.hs') diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs index b717fe19..358cc8c3 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,14 +156,10 @@ 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) -- | Causes *any* docker images that are not in use by running containers to @@ -222,7 +219,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" @@ -385,7 +382,14 @@ 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 - (runps ++ ["-i", "-d", "-t"]) + -- 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"]) [shim, "--docker", fromContainerId cid] -- | Called when propellor is running inside a docker container. -- cgit v1.2.3