From 50afe5b031a6b63f9eca3937a2dd104bf23d4828 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 15 Aug 2018 17:27:26 +0200 Subject: podman: fix --uts=host Do not set any hostname value in the OCI configuration when --uts=host is used and the user didn't specify any value. This prevents an error from the OCI runtime as it cannot set the hostname without a new UTS namespace. Differently, the HOSTNAME environment variable is always set. When --uts=host is used, HOSTNAME gets the value from the host. Signed-off-by: Giuseppe Scrivano Closes: #1280 Approved by: baude --- test/e2e/run_networking_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/e2e') diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go index a4bdcdf89..021825d4b 100644 --- a/test/e2e/run_networking_test.go +++ b/test/e2e/run_networking_test.go @@ -114,6 +114,20 @@ var _ = Describe("Podman rmi", func() { match, _ := session.GrepString(hostname) Expect(match).Should(BeTrue()) }) + It("podman run --net host --uts host hostname test", func() { + session := podmanTest.Podman([]string{"run", "--rm", "--net", "host", "--uts", "host", ALPINE, "printenv", "HOSTNAME"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + match, _ := session.GrepString(hostname) + Expect(match).Should(BeTrue()) + }) + It("podman run --uts host hostname test", func() { + session := podmanTest.Podman([]string{"run", "--rm", "--uts", "host", ALPINE, "printenv", "HOSTNAME"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + match, _ := session.GrepString(hostname) + Expect(match).Should(BeTrue()) + }) It("podman run --net host --hostname ... hostname test", func() { session := podmanTest.Podman([]string{"run", "--rm", "--net", "host", "--hostname", "foobar", ALPINE, "printenv", "HOSTNAME"}) -- cgit v1.2.3-54-g00ecf