diff --git a/daemon/daemon_unix.go b/daemon/daemon_unix.go index e4b33daeaf..d3197e3c30 100644 --- a/daemon/daemon_unix.go +++ b/daemon/daemon_unix.go @@ -81,12 +81,16 @@ func (daemon *Daemon) createRootfs(container *Container) error { if err != nil { return err } - defer daemon.driver.Put(initID) if err := setupInitLayer(initPath); err != nil { + daemon.driver.Put(initID) return err } + // We want to unmount init layer before we take snapshot of it + // for the actual container. + daemon.driver.Put(initID) + if err := daemon.driver.Create(container.ID, initID); err != nil { return err }