summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container.go3
-rw-r--r--libpod/runtime_ctr.go2
2 files changed, 3 insertions, 2 deletions
diff --git a/libpod/container.go b/libpod/container.go
index aa80fb4a5..e69037353 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -12,6 +12,7 @@ import (
"github.com/containers/storage"
"github.com/containers/storage/pkg/archive"
+ "github.com/docker/docker/pkg/namesgenerator"
"github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/pkg/term"
spec "github.com/opencontainers/runtime-spec/specs-go"
@@ -329,7 +330,7 @@ func newContainer(rspec *spec.Spec) (*Container, error) {
ctr.state = new(containerRuntimeInfo)
ctr.config.ID = stringid.GenerateNonCryptoID()
- ctr.config.Name = ctr.config.ID // TODO generate unique human-readable names
+ ctr.config.Name = namesgenerator.GetRandomName(0)
ctr.config.Spec = new(spec.Spec)
deepcopier.Copy(rspec).To(ctr.config.Spec)
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index 594e35dc5..58074cc43 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -69,7 +69,7 @@ func (r *Runtime) NewContainer(spec *spec.Spec, options ...CtrCreateOption) (c *
}()
if err := r.state.AddContainer(ctr); err != nil {
- // TODO: Might be worth making an effort to detect duplicate IDs
+ // TODO: Might be worth making an effort to detect duplicate IDs and names
// We can recover from that by generating a new ID for the
// container
return nil, errors.Wrapf(err, "error adding new container to state")