1
0
mirror of https://github.com/docker/cli.git synced 2026-01-16 20:22:36 +03:00

Fix lxc-start in lxc>1.1.0 where containers start daemonized by default

Signed-off-by: Michal Fojtik <mfojtik@redhat.com>
Upstream-commit: d62f25e4220d1d1ca792adf9c7423ee60a00c0d7
Component: engine
This commit is contained in:
Michal Fojtik
2015-02-03 12:41:21 +01:00
parent 6061dc16e1
commit 825ed262fe

View File

@@ -20,6 +20,7 @@ import (
"github.com/docker/docker/daemon/execdriver"
sysinfo "github.com/docker/docker/pkg/system"
"github.com/docker/docker/pkg/term"
"github.com/docker/docker/pkg/version"
"github.com/docker/docker/utils"
"github.com/docker/libcontainer"
"github.com/docker/libcontainer/cgroups"
@@ -115,6 +116,13 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
"-n", c.ID,
"-f", configPath,
}
// From lxc>=1.1 the default behavior is to daemonize containers after start
lxcVersion := version.Version(d.version())
if lxcVersion.GreaterThanOrEqualTo(version.Version("1.1")) {
params = append(params, "-F")
}
if c.Network.ContainerID != "" {
params = append(params,
"--share-net", c.Network.ContainerID,