Skip to content

Commit

Permalink
add constraints to docker driver for json-file logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzyfresh committed Jun 17, 2019
1 parent fcd42f6 commit cebfc74
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions drivers/docker/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,22 @@ func (d *Driver) createContainerConfig(task *drivers.TaskConfig, driverConfig *T
Config: driverConfig.Logging.Config,
}

if hostConfig.LogConfig.Type == "json-file" || hostConfig.LogConfig.Type == "" {
logger.Debug("configuring docker json-file logs")
hostConfig.LogConfig.Type = "json-file"
if hostConfig.LogConfig.Config == nil {
hostConfig.LogConfig.Config = make(map[string]string)
}
hostConfig.LogConfig.Config["mode"] = "non-blocking"
hostConfig.LogConfig.Config["max-file"] = "3"
hostConfig.LogConfig.Config["max-size"] = "10m"
}
logger.Debug("configured logs", "type", hostConfig.LogConfig.Type,
"mode", hostConfig.LogConfig.Config["mode"],
"max-file", hostConfig.LogConfig.Config["max-file"],
"max-size", hostConfig.LogConfig.Config["max-size"])


logger.Debug("configured resources", "memory", hostConfig.Memory,
"cpu_shares", hostConfig.CPUShares, "cpu_quota", hostConfig.CPUQuota,
"cpu_period", hostConfig.CPUPeriod)
Expand Down

0 comments on commit cebfc74

Please sign in to comment.