diff options
Diffstat (limited to 'libpod/runtime_ctr.go')
-rw-r--r-- | libpod/runtime_ctr.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index 51c2001d0..3b4710d96 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -50,6 +50,15 @@ func (r *Runtime) NewContainer(rSpec *spec.Spec, options ...CtrCreateOption) (c ctr.state.State = ContainerStateConfigured ctr.runtime = r + if ctr.config.Name == "" { + name, err := r.generateName() + if err != nil { + return nil, err + } + + ctr.config.Name = name + } + // Set up storage for the container if err := ctr.setupStorage(); err != nil { return nil, errors.Wrapf(err, "error configuring storage for container") |