如何从 lxd 主机为 lxd 容器启用主机名解析(dns)?

如何从 lxd 主机为 lxd 容器启用主机名解析(dns)?

如何从 lxd 主机启用 lxd 主机名解析?

创建以下容器后:

>>> lxc launch ubuntu: container
Creating container
Starting container

>>> lxc list
+-----------------+---------+----------------------+------+------------+-----------+
| container       | RUNNING | 10.240.38.157 (eth0) |      | PERSISTENT | 0         |
+-----------------+---------+----------------------+------+------------+-----------+

可以使用 IP 地址但不能使用主机名访问:

>>> ping 10.240.38.157 -c 3
PING 10.240.38.157 (10.240.38.157) 56(84) bytes of data.
64 bytes from 10.240.38.157: icmp_seq=1 ttl=64 time=0.082 ms
64 bytes from 10.240.38.157: icmp_seq=2 ttl=64 time=0.053 ms
64 bytes from 10.240.38.157: icmp_seq=3 ttl=64 time=0.041 ms

--- 10.240.38.157 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2044ms
rtt min/avg/max/mdev = 0.041/0.058/0.082/0.019 ms

>>> ping container
ping: unknown host container

如何使 lxd 容器能够通过主机名从 lxd 主机访问?

相关内容