Question docker host know container ip and hostname

See this answer, this make possible to run a container and solve it by hostname at host machine, it would be helpful for development

docker run --rm --hostname dns.mageddo --name dns-proxy-server -p 5380:5380 \
  -v /opt/dns-proxy-server/conf:/app/conf \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /etc/resolv.conf:/etc/resolv.conf \

Running a test container

docker run --hostname nginx

Testing it

PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=0.099 ms
64 bytes from icmp_seq=2 ttl=64 time=0.069 ms
1 Like