oci: keep exposed ports busy and leak the fd into conmon

Bind all the specified TCP and UDP ports so that another process
cannot reuse them.  The fd of the listener is then leaked into conmon
so that the socket is kept busy until the container exits.

Closes: https://github.com/projectatomic/libpod/issues/210

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1100
Approved by: mheon
This commit is contained in:
Giuseppe Scrivano
2018-07-16 13:40:59 +02:00
committed by Atomic Bot
parent 4a6f79b62b
commit 9ae7b1a5b1
2 changed files with 62 additions and 0 deletions

View File

@ -65,6 +65,10 @@ var _ = Describe("Podman rmi", func() {
results.Wait(30)
Expect(results.ExitCode()).To(Equal(0))
Expect(results.OutputToString()).To(ContainSubstring("8000"))
ncBusy := podmanTest.SystemExec("nc", []string{"-l", "-p", "80"})
ncBusy.Wait(10)
Expect(ncBusy.ExitCode()).ToNot(Equal(0))
})
It("podman run network expose ports in image metadata", func() {