mirror of
https://github.com/containers/podman.git
synced 2025-12-16 03:57:36 +08:00
Merge pull request #8067 from mheon/net_host_hosts
Ensure that hostname is added to hosts with net=host
This commit is contained in:
@@ -571,4 +571,19 @@ var _ = Describe("Podman run networking", func() {
|
||||
podrm.WaitWithDefaultTimeout()
|
||||
Expect(podrm.ExitCode()).To(BeZero())
|
||||
})
|
||||
|
||||
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.ExitCode()).To(BeZero())
|
||||
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"})
|
||||
run.WaitWithDefaultTimeout()
|
||||
Expect(run.ExitCode()).To(BeZero())
|
||||
Expect(strings.Contains(run.OutputToString(), "testctr")).To(BeTrue())
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user