Log container name and labels
This commit is contained in:
parent
640af994ca
commit
0e1fe2373a
|
@ -238,7 +238,7 @@ func (d *DockerDriver) createContainer(ctx *ExecContext, task *structs.Task, dri
|
||||||
hostConfig.NetworkMode = driverConfig.NetworkMode
|
hostConfig.NetworkMode = driverConfig.NetworkMode
|
||||||
if hostConfig.NetworkMode == "" {
|
if hostConfig.NetworkMode == "" {
|
||||||
// docker default
|
// docker default
|
||||||
d.logger.Println("[INFO] driver.docker: networking mode not specified; defaulting to bridge")
|
d.logger.Println("[DEBUG] driver.docker: networking mode not specified; defaulting to bridge")
|
||||||
hostConfig.NetworkMode = "bridge"
|
hostConfig.NetworkMode = "bridge"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,12 +319,16 @@ func (d *DockerDriver) createContainer(ctx *ExecContext, task *structs.Task, dri
|
||||||
|
|
||||||
if len(driverConfig.Labels) == 1 {
|
if len(driverConfig.Labels) == 1 {
|
||||||
config.Labels = driverConfig.Labels[0]
|
config.Labels = driverConfig.Labels[0]
|
||||||
d.logger.Println("[DEBUG] driver.docker: applied labels on the container")
|
d.logger.Printf("[DEBUG] driver.docker: applied labels on the container: %+v\n", config.Labels)
|
||||||
}
|
}
|
||||||
|
|
||||||
config.Env = env.List()
|
config.Env = env.List()
|
||||||
|
|
||||||
|
containerName := fmt.Sprintf("%s-%s", task.Name, ctx.AllocID)
|
||||||
|
d.logger.Printf("[DEBUG] driver.docker: setting container name to: %s\n", containerName)
|
||||||
|
|
||||||
return docker.CreateContainerOptions{
|
return docker.CreateContainerOptions{
|
||||||
Name: fmt.Sprintf("%s-%s", task.Name, ctx.AllocID),
|
Name: containerName,
|
||||||
Config: config,
|
Config: config,
|
||||||
HostConfig: hostConfig,
|
HostConfig: hostConfig,
|
||||||
}, nil
|
}, nil
|
||||||
|
|
Loading…
Reference in New Issue