From 7aefc1ac33ba153f6177e9fe3c4da886de49a9e2 Mon Sep 17 00:00:00 2001 From: Chen Zhiwei Date: Sat, 17 Aug 2019 02:42:36 +0000 Subject: Allow customizing pod hostname * set hostname in pod yaml file * set --hostname in pod create command Signed-off-by: Chen Zhiwei --- libpod/runtime_pod_linux.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libpod/runtime_pod_linux.go') diff --git a/libpod/runtime_pod_linux.go b/libpod/runtime_pod_linux.go index f38e6e7c1..073c5054d 100644 --- a/libpod/runtime_pod_linux.go +++ b/libpod/runtime_pod_linux.go @@ -52,6 +52,10 @@ func (r *Runtime) NewPod(ctx context.Context, options ...PodCreateOption) (_ *Po pod.config.Name = name } + if pod.config.Hostname == "" { + pod.config.Hostname = pod.config.Name + } + // Allocate a lock for the pod lock, err := r.lockManager.AllocateLock() if err != nil { -- cgit v1.2.3-54-g00ecf