From 0e1fe2373a275f7aba1d1ac5f845af6b04e4dcbb Mon Sep 17 00:00:00 2001 From: Chris Bednarski Date: Tue, 17 Nov 2015 20:04:10 -0800 Subject: [PATCH] Log container name and labels --- client/driver/docker.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/driver/docker.go b/client/driver/docker.go index 93a0debfc..ed12db18e 100644 --- a/client/driver/docker.go +++ b/client/driver/docker.go @@ -238,7 +238,7 @@ func (d *DockerDriver) createContainer(ctx *ExecContext, task *structs.Task, dri hostConfig.NetworkMode = driverConfig.NetworkMode if hostConfig.NetworkMode == "" { // 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" } @@ -319,12 +319,16 @@ func (d *DockerDriver) createContainer(ctx *ExecContext, task *structs.Task, dri if len(driverConfig.Labels) == 1 { 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() + + 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{ - Name: fmt.Sprintf("%s-%s", task.Name, ctx.AllocID), + Name: containerName, Config: config, HostConfig: hostConfig, }, nil