diff options
author | Paul Holzinger <pholzing@redhat.com> | 2022-04-21 12:29:31 +0200 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2022-04-22 13:06:00 +0200 |
commit | e4ab8a5bedb48615402231a5aa3a62ca4364c45f (patch) | |
tree | 15392d384af7d761dc1ff9ed97f4a6dbc99c6bc3 /test/e2e/run_networking_test.go | |
parent | cf1b0c1965c9cc7f3b6d870720ba78865c8602e4 (diff) | |
download | podman-e4ab8a5bedb48615402231a5aa3a62ca4364c45f.tar.gz podman-e4ab8a5bedb48615402231a5aa3a62ca4364c45f.tar.bz2 podman-e4ab8a5bedb48615402231a5aa3a62ca4364c45f.zip |
shared netns and --add-host should conflict
Because /etc/hosts is shared for all containers with a shared network
namespace you should not be able to add hosts from a joined container.
Only the primary netns container can set the hosts.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'test/e2e/run_networking_test.go')
-rw-r--r-- | test/e2e/run_networking_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go index 696668e52..49c387227 100644 --- a/test/e2e/run_networking_test.go +++ b/test/e2e/run_networking_test.go @@ -608,6 +608,18 @@ EXPOSE 2004-2005/tcp`, ALPINE) Expect(ctr2).Should(Exit(0)) }) + It("podman run --net container: and --add-host should fail", func() { + ctrName := "ctrToJoin" + ctr1 := podmanTest.RunTopContainer(ctrName) + ctr1.WaitWithDefaultTimeout() + Expect(ctr1).Should(Exit(0)) + + ctr2 := podmanTest.Podman([]string{"run", "-d", "--net=container:" + ctrName, "--add-host", "host1:127.0.0.1", ALPINE, "true"}) + ctr2.WaitWithDefaultTimeout() + Expect(ctr2).Should(ExitWithError()) + Expect(ctr2.ErrorToString()).Should(ContainSubstring("cannot set extra host entries when the container is joined to another containers network namespace: invalid configuration")) + }) + It("podman run --net container: copies hosts and resolv", func() { ctrName := "ctr1" ctr1 := podmanTest.RunTopContainer(ctrName) |