diff --git a/containerd/driver.go b/containerd/driver.go index 2159e39..bcd53ea 100644 --- a/containerd/driver.go +++ b/containerd/driver.go @@ -35,7 +35,6 @@ import ( "github.com/hashicorp/nomad/plugins/drivers" "github.com/hashicorp/nomad/plugins/shared/hclspec" "github.com/hashicorp/nomad/plugins/shared/structs" - "github.com/moby/moby/pkg/namesgenerator" ) const ( @@ -368,15 +367,14 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive handle := drivers.NewTaskHandle(taskHandleVersion) handle.Config = cfg - // Generate a random container name using docker namesgenerator package. - // https://github.com/moby/moby/blob/master/pkg/namesgenerator/names-generator.go - containerName := cfg.AllocID[:8] + "_" + namesgenerator.GetRandomName(1) + // https://www.nomadproject.io/docs/drivers/docker#container-name + containerName := cfg.Name + "-" + cfg.AllocID containerConfig.ContainerName = containerName var err error containerConfig.Image, err = d.pullImage(driverConfig.Image) if err != nil { - return nil, nil, fmt.Errorf("Error in pulling image: %v", err) + return nil, nil, fmt.Errorf("Error in pulling image %s: %v", driverConfig.Image, err) } d.logger.Info(fmt.Sprintf("Successfully pulled %s image\n", containerConfig.Image.Name())) diff --git a/go.mod b/go.mod index 22b7add..749573f 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,6 @@ require ( github.com/hashicorp/nomad v0.10.1 github.com/hashicorp/nomad/api v0.0.0-20191203164002-b31573ae7206 // indirect github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b // indirect - github.com/moby/moby v1.13.1 github.com/mrunalp/fileutils v0.0.0-20171103030105-7d4729fb3618 // indirect github.com/opencontainers/runc v1.0.0-rc8.0.20190611121236-6cc515888830 // indirect github.com/opencontainers/runtime-spec v1.0.2