Podman --hostname option does not change the /etc/hosts entries

Solution Verified - Updated -

Issue

When the container is created using podman with a specific hostname by including --hostname option, hostname is getting changed but the content of /etc/hosts remains unchanged.

  • Create a container using podman with --hostname option enabled:
podman run -dt --pod new:test --hostname alpine --name alpine alpine
  • Execute cat /etc/hosts command inside the newly created container.
 podman exec -ti alpine cat /etc/hosts    

127.0.0.1   localhost localhost.localdomain localhost4 localhost4 .localdomain4
::1         localhost localhost.localdomain localhost6 localhost6 .localdomain6
10.88.0.10    mrsdalloway 

Environment

  • Red Hat Enterprise Linux (RHEL) 7
  • Red Hat Enterprise Linux (RHEL) 8

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content