Skip to content

Commit

Permalink
Mention no_hosts and base_hosts_file configs in CLI option docs
Browse files Browse the repository at this point in the history
Follow-up to #24043

Signed-off-by: Daniel Rudolf <[email protected]>
  • Loading branch information
PhrozenByte committed Oct 1, 2024
1 parent ded7833 commit c9d950d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion docs/source/markdown/options/add-host.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ a single IPv4 or IPv6 address, separated by a colon. It can also be used to
overwrite the IP addresses of hostnames Podman adds to `/etc/hosts` by default
(also see the **--name** and **--hostname** options). This option can be
specified multiple times to add additional mappings to `/etc/hosts`. It
conflicts with the **--no-hosts** option.
conflicts with the **--no-hosts** option and conflicts with *no_hosts=true* in
`containers.conf`.

Instead of an IP address, the special flag *host-gateway* can be given. This
resolves to an IP address the container can use to connect to the host. The
Expand All @@ -27,3 +28,8 @@ You can prevent that by either giving the **--no-hosts** option, or by setting
address was configured manually and Podman fails to determine the IP address
automatically, Podman will silently skip adding these internal hostnames to
`/etc/hosts`.

Podman will use the host's `/etc/hosts` file as a basis by default, i.e. any
hostname present in this file will also be present in the container's
`/etc/hosts` file. A different base file can be configured using the
*base_hosts_file* config in `containers.conf`.
3 changes: 2 additions & 1 deletion docs/source/markdown/options/no-hosts.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ hostname (see **--hostname** option), the internal `host.containers.internal`
and `host.docker.internal` hosts, as well as any hostname added using the
**--add-host** option. Refer to the **--add-host** option for details. Passing
**--no-hosts** disables this, so that the image's `/etc/hosts` file is kept
unmodified.
unmodified. The same can be achieved globally by setting *no_hosts=true* in
`containers.conf`.

0 comments on commit c9d950d

Please sign in to comment.