From 9c52175641690348d078255381c3aefcc0c7efb3 Mon Sep 17 00:00:00 2001 From: Chelsea Holland Komlo Date: Fri, 25 May 2018 19:54:14 -0400 Subject: [PATCH] Support Docker Pids Limit --- client/driver/docker.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/driver/docker.go b/client/driver/docker.go index c3f920361..a0c5ed9d4 100644 --- a/client/driver/docker.go +++ b/client/driver/docker.go @@ -234,6 +234,7 @@ type DockerDriverConfig struct { ReadonlyRootfs bool `mapstructure:"readonly_rootfs"` // Mount the container’s root filesystem as read only AdvertiseIPv6Address bool `mapstructure:"advertise_ipv6_address"` // Flag to use the GlobalIPv6Address from the container as the detected IP CPUHardLimit bool `mapstructure:"cpu_hard_limit"` // Enforce CPU hard limit. + PidsLimit int64 `mapstructure:"pids_limit"` // Enforce Docker Pids limit } func sliceMergeUlimit(ulimitsRaw map[string]string) ([]docker.ULimit, error) { @@ -736,6 +737,9 @@ func (d *DockerDriver) Validate(config map[string]interface{}) error { "cpu_hard_limit": { Type: fields.TypeBool, }, + "pids_limit": { + Type: fields.TypeInt, + }, }, } @@ -1216,6 +1220,8 @@ func (d *DockerDriver) createContainerConfig(ctx *ExecContext, task *structs.Tas Binds: binds, VolumeDriver: driverConfig.VolumeDriver, + + PidsLimit: driverConfig.PidsLimit, } // Calculate CPU Quota