Add support for shm_size to docker driver. Required update of go-dockerclient

to more recent version (ba4298ecf4cfa216f1cce2befbf653359f62c722).
This commit is contained in:
Daniel Kerwin
2016-05-27 12:30:04 +02:00
parent 7455413551
commit 98b227fecf
17 changed files with 402 additions and 183 deletions

View File

@@ -80,6 +80,7 @@ type DockerDriverConfig struct {
SSL bool `mapstructure:"ssl"` // Flag indicating repository is served via https
TTY bool `mapstructure:"tty"` // Allocate a Pseudo-TTY
Interactive bool `mapstructure:"interactive"` // Keep STDIN open even if not attached
ShmSize int64 `mapstructure:"shm_size"` // Size of /dev/shm of the container in bytes
}
func (c *DockerDriverConfig) Init() error {
@@ -190,6 +191,9 @@ func (d *DockerDriver) Validate(config map[string]interface{}) error {
"interactive": &fields.FieldSchema{
Type: fields.TypeBool,
},
"shm_size": &fields.FieldSchema{
Type: fields.TypeInt,
},
},
}
@@ -349,6 +353,11 @@ func (d *DockerDriver) createContainer(ctx *ExecContext, task *structs.Task,
}
hostConfig.Privileged = hostPrivileged
// set SHM size
if driverConfig.ShmSize != 0 {
hostConfig.ShmSize = driverConfig.ShmSize
}
// set DNS servers
for _, ip := range driverConfig.DNSServers {
if net.ParseIP(ip) != nil {