Browse code

Merge pull request #10527 from mfojtik/lxc_11

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

Jessie Frazelle authored on 2015/03/25 09:37:27
Showing 1 changed files
... ...
@@ -20,6 +20,7 @@ import (
20 20
 	"github.com/docker/docker/daemon/execdriver"
21 21
 	sysinfo "github.com/docker/docker/pkg/system"
22 22
 	"github.com/docker/docker/pkg/term"
23
+	"github.com/docker/docker/pkg/version"
23 24
 	"github.com/docker/docker/utils"
24 25
 	"github.com/docker/libcontainer"
25 26
 	"github.com/docker/libcontainer/cgroups"
... ...
@@ -118,6 +119,13 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
118 118
 		"-n", c.ID,
119 119
 		"-f", configPath,
120 120
 	}
121
+
122
+	// From lxc>=1.1 the default behavior is to daemonize containers after start
123
+	lxcVersion := version.Version(d.version())
124
+	if lxcVersion.GreaterThanOrEqualTo(version.Version("1.1")) {
125
+		params = append(params, "-F")
126
+	}
127
+
121 128
 	if c.Network.ContainerID != "" {
122 129
 		params = append(params,
123 130
 			"--share-net", c.Network.ContainerID,