propellor spin
This commit is contained in:
parent
527fff74c3
commit
c224625734
|
@ -224,7 +224,7 @@ hosts = -- (o) `
|
|||
in GitAnnexBuilder.androidContainer dockerImage "android-git-annex" doNothing gitannexdir
|
||||
& Docker.volume ("/home/joey/src/git-annex:" ++ gitannexdir)
|
||||
|
||||
-- temp for an aqquantance
|
||||
-- temp for an accuantance
|
||||
, standardContainer "voltagex" Stable "amd64"
|
||||
& Docker.publish "22022:22"
|
||||
& Apt.serviceInstalledRunning "ssh"
|
||||
|
|
|
@ -11,6 +11,7 @@ module Propellor.Property.Docker (
|
|||
configured,
|
||||
container,
|
||||
docked,
|
||||
memoryLimited,
|
||||
garbageCollected,
|
||||
Image,
|
||||
ContainerName,
|
||||
|
@ -25,6 +26,7 @@ module Propellor.Property.Docker (
|
|||
volumes_from,
|
||||
workdir,
|
||||
memory,
|
||||
cpuShares,
|
||||
link,
|
||||
ContainerAlias,
|
||||
-- * Internal use
|
||||
|
@ -170,6 +172,20 @@ garbageCollected = propertyList "docker garbage collected"
|
|||
gcimages = property "docker images garbage collected" $ do
|
||||
liftIO $ report <$> (mapM removeImage =<< listImages)
|
||||
|
||||
-- | Configures the kernel to respect docker memory limits.
|
||||
--
|
||||
-- This assumes the system boots using grub 2. And that you don't need any
|
||||
-- other GRUB_CMDLINE_LINUX_DEFAULT settings.
|
||||
--
|
||||
-- Only takes effect after reboot. (Not automated.)
|
||||
memoryLimited :: Property
|
||||
memoryLimited = "/etc/default/grub" `File.containsLine` cfg
|
||||
`describe` "docker memory limited"
|
||||
`onChange` cmdProperty "update-grub" []
|
||||
where
|
||||
cmdline = "cgroup_enable=memory swapaccount=1"
|
||||
cfg = "GRUB_CMDLINE_LINUX_DEFAULT=\""++cmdline++"\""
|
||||
|
||||
data Container = Container Image [RunParam]
|
||||
|
||||
-- | Parameters to pass to `docker run` when creating a container.
|
||||
|
@ -220,10 +236,17 @@ workdir :: String -> Property
|
|||
workdir = runProp "workdir"
|
||||
|
||||
-- | Memory limit for container.
|
||||
--Format: <number><optional unit>, where unit = b, k, m or g
|
||||
-- Format: <number><optional unit>, where unit = b, k, m or g
|
||||
--
|
||||
-- Note: Only takes effect when the host has the memoryLimited property
|
||||
-- enabled.
|
||||
memory :: String -> Property
|
||||
memory = runProp "memory"
|
||||
|
||||
-- | CPU shares (relative weight).
|
||||
cpuShares :: Int -> Property
|
||||
cpuShares = runProp "cpu-shares" . show
|
||||
|
||||
-- | Link with another container on the same host.
|
||||
link :: ContainerName -> ContainerAlias -> Property
|
||||
link linkwith calias = genProp "link" $ \hn ->
|
||||
|
|
Loading…
Reference in New Issue