Merge pull request #109 from vmarmol/fix-slice

Fix Docker container slice in systemd systems.
This commit is contained in:
monnand 2014-07-23 13:05:17 -04:00
commit 3474eec100

View File

@ -61,9 +61,9 @@ func (self *dockerFactory) NewContainerHandler(name string) (handler container.C
// Docker handles all containers under /docker // Docker handles all containers under /docker
// TODO(vishh): Change the CanHandle interface to be able to return errors. // TODO(vishh): Change the CanHandle interface to be able to return errors.
func (self *dockerFactory) CanHandle(name string) bool { func (self *dockerFactory) CanHandle(name string) bool {
// In systemd systems the containers are: /docker-{ID} // In systemd systems the containers are: /system.slice/docker-{ID}
if self.useSystemd { if self.useSystemd {
if !strings.HasPrefix(name, "/docker-") { if !strings.HasPrefix(name, "/system.slice/docker-") {
return false return false
} }
} else if name == "/" { } else if name == "/" {
@ -136,6 +136,9 @@ func Register(factory info.MachineInfoFactory) error {
useSystemd: systemd.UseSystemd(), useSystemd: systemd.UseSystemd(),
client: client, client: client,
} }
if f.useSystemd {
log.Printf("System is using systemd")
}
log.Printf("Registering Docker factory") log.Printf("Registering Docker factory")
container.RegisterContainerHandlerFactory(f) container.RegisterContainerHandlerFactory(f)
return nil return nil