docker - Start container in existing cgroup -


i'm looking write custom mesos executor allow doing things requesting 1cpu(1024 shares) rails application, , "plugging in" nginx in front. in process, i'd start rails , nginx containers using same shared 1024 cpu shares.

i understand cgroups hierarchical, , should able like

  base(1024 shares)   /              \ nginx(no limit)   rails(no limit) 

or

  rails(1024 shares)          |     nginx(no limit) 

so still use 1 cpu, containers share resources , linked. looking through cgroups , lxc docs, couldn't find obvious pass docker's -lxc-conf=[] option allow me tell nginx started start under pre-existing cgroup created started rails container.

another thing need consider while want rails , nginx share 1024 cpu shares, don't want either know other or have access each other's data unless have deliberately shared /public volume rails or something.

any advice here appreciated!

docker doesn't support (yet).

here possible workaround. warning: hackish. don't recommend using in production, gives idea of involved.

we use mesos hook (or tool docker spotter) trigger automatic actions when containers started.

we use separate, manually created cgroup appropriate cpu share allocation.

when tool detects 1 of 2 containers started, moves processes special cgroup. since child processes created in control group of parent, future processes in cgroup.

note, however, there potential race condition: if new processes created in containers while move existing processes original cgroup "static" one, new processes might not moved automatically. have rescan tasks file multiple times make sure moved everything.

a better implementation in docker itself; maybe allowing creation of "container containers" (containers don't run processes there group other containers) , put container under one. or, alternatively, syntax similar --volumes-from, resources. allow start container instruct docker create cgroups under existing container.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -