From cfcd1e1863ad4fb31476364bde64a70dc1f1196c Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Tue, 3 Aug 2021 14:07:28 -0400 Subject: Do not add an entry to /etc/hosts with `--net=host` To match Docker's behavior, in the `--net=host` case, we need to use the host's `/etc/hosts` file, unmodified (without adding an entry for the container). We will still respect hosts from `--add-host` but will not make any automatic changes. Fortuntely, this is strictly a matter of removal and refactoring as we already base our `/etc/hosts` on the host's version - just need to remove the code that added entries when net=host was set. Fixes #10319 Signed-off-by: Matthew Heon --- test/e2e/run_networking_test.go | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'test') diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go index 80a82ea05..92388b099 100644 --- a/test/e2e/run_networking_test.go +++ b/test/e2e/run_networking_test.go @@ -685,13 +685,6 @@ var _ = Describe("Podman run networking", func() { Expect(podrm).Should(Exit(0)) }) - It("podman run net=host adds entry to /etc/hosts", func() { - run := podmanTest.Podman([]string{"run", "--net=host", ALPINE, "cat", "/etc/hosts"}) - run.WaitWithDefaultTimeout() - Expect(run).Should(Exit(0)) - Expect(strings.Contains(run.OutputToString(), "127.0.1.1")).To(BeTrue()) - }) - It("podman run with --net=host and --hostname sets correct hostname", func() { hostname := "testctr" run := podmanTest.Podman([]string{"run", "--net=host", "--hostname", hostname, ALPINE, "hostname"}) @@ -731,10 +724,6 @@ var _ = Describe("Podman run networking", func() { ping_test("--net=none") }) - It("podman attempt to ping container name and hostname --net=host", func() { - ping_test("--net=host") - }) - It("podman attempt to ping container name and hostname --net=private", func() { ping_test("--net=private") }) -- cgit v1.2.3-54-g00ecf