How to set hostname to podman containers ?
Environment
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 9
Resolution
-
Use the flag -h or --hostname to specify the hostname for containers. You can use the below format to do the same.
# podman run -itd -h <hostname> <image> -
Note that hostname can be assigned to a container only when creating them. You can not change them during the runtime as podman containers are immutable and the properties can not change when they are already running.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments