podman: podman: --add-host does not work when specifying --pod

/kind bug

Description

when we specify--pod=mypod

$ podman pod create --name=mypod
a81e2efafd48451354ebc5051d7d2babeb9a90e71411af73be75323d60891190
$ podman run --pod=mypod --add-host 'foobar:127.0.0.1' --rm -ti busybox ping -c 5 foobar
ping: bad address 'foobar'

but normally it would work like this

$ podman run --add-host 'foobar:127.0.0.1' --rm -ti busybox ping -c 5 foobar
PING foobar (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: seq=0 ttl=64 time=0.041 ms
64 bytes from 127.0.0.1: seq=1 ttl=64 time=0.082 ms
64 bytes from 127.0.0.1: seq=2 ttl=64 time=0.092 ms
64 bytes from 127.0.0.1: seq=3 ttl=64 time=0.058 ms
64 bytes from 127.0.0.1: seq=4 ttl=64 time=0.128 ms

--- foobar ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.041/0.080/0.128 ms

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Yes. Containers in a pod should share the same /etc/hosts and /etc/resolv.conf.