From c54816dfc39b00824b9d4902ed2e533b3c6c07a7 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Sat, 17 Mar 2018 20:08:27 -0400 Subject: Check for duplicate names when generating new container and pod names. This fixes the situation where we fail to create a container when a name already exists. Signed-off-by: Daniel J Walsh Closes: #517 Approved by: baude --- libpod/runtime_pod.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libpod/runtime_pod.go') diff --git a/libpod/runtime_pod.go b/libpod/runtime_pod.go index 3619a7a82..44910b180 100644 --- a/libpod/runtime_pod.go +++ b/libpod/runtime_pod.go @@ -35,6 +35,14 @@ func (r *Runtime) NewPod(options ...PodCreateOption) (*Pod, error) { } } + if pod.config.Name == "" { + name, err := r.generateName() + if err != nil { + return nil, err + } + pod.config.Name = name + } + pod.valid = true if err := r.state.AddPod(pod); err != nil { -- cgit v1.2.3-54-g00ecf