Pode-se utilizar servidores DNS ou o arquivo host para definir o IP e nome para acesso.
No Linux o arquivo pode ser localizado conforme abaixo:
$ cat /etc/hosts
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateHosts = false
127.0.0.1 localhost
127.0.1.1 Latitude5440. Latitude5440
10.0.0.38 host.docker.internal
10.0.0.38 gateway.docker.internal
127.0.0.1 kubernetes.docker.internal
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
No Windows pode ser localizado em C:\Windows\System32\drivers\etc:
Isso também pode ser feito no container. Por exemplo, o container que está em execução:
$ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
10ec7dc1b4bc nginx "/docker-entrypoint.…" 26 minutes ago Up 26 minutes cool_benz
root@a6e53af355d0:/# apt update && apt install curl --yes
root@a6e53af355d0:/# curl
curl: try 'curl --help' or 'curl --manual' for more information
root@a6e53af355d0:/# curl barbieri.com.br
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>