Skip to content

Commit

Permalink
Only launch syslog server if container uses syslog
Browse files Browse the repository at this point in the history
  • Loading branch information
schmichael committed Oct 3, 2016
1 parent fe1e3c7 commit cc5b40e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions client/driver/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -791,12 +791,18 @@ func (d *DockerDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle
PortLowerBound: d.config.ClientMinPort,
PortUpperBound: d.config.ClientMaxPort,
}
ss, err := exec.LaunchSyslogServer(executorCtx)
if err != nil {
return nil, fmt.Errorf("failed to start syslog collector: %v", err)

// Only launch syslog server if we're going to use it!
syslogAddr := ""
if len(driverConfig.Logging) == 0 || driverConfig.Logging[0].Type == "syslog" {
ss, err := exec.LaunchSyslogServer(executorCtx)
if err != nil {
return nil, fmt.Errorf("failed to start syslog collector: %v", err)
}
syslogAddr = ss.Addr
}

config, err := d.createContainer(ctx, task, driverConfig, ss.Addr)
config, err := d.createContainer(ctx, task, driverConfig, syslogAddr)
if err != nil {
d.logger.Printf("[ERR] driver.docker: failed to create container configuration for image %s: %s", image, err)
pluginClient.Kill()
Expand Down

0 comments on commit cc5b40e

Please sign in to comment.