How to enable lxd hostname resolution from the lxd host?

After creating the below container:

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

>>> lxc list
| container       | RUNNING | (eth0) |      | PERSISTENT | 0         |

It can be reached using the IP address but not using the hostname:

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

--- 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

How to enable the lxd containers to be reached by hostname from the lxd host?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.