Skip to content

Commit

Permalink
Merge pull request #1207 from dkerwin/docker_add_shm_size
Browse files Browse the repository at this point in the history
Add support for shm_size to docker driver
  • Loading branch information
diptanu committed May 29, 2016
2 parents dc8ebc7 + d4dca3b commit e3f8d31
Show file tree
Hide file tree
Showing 133 changed files with 2,860 additions and 2,267 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ _testmain.go
*.prof

bin/
pkg/
/pkg/
.vagrant/
website/build/
website/npm-debug.log
Expand Down
9 changes: 9 additions & 0 deletions client/driver/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
},
},
}

Expand Down Expand Up @@ -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 {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e3f8d31

Please sign in to comment.