CentOS 7.x lxc container creation fails due to host resolution

From Notes_Wiki
Revision as of 08:59, 25 August 2022 by Saurabh (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Home > CentOS > CentOS 7.x > Virtualization > Lxc > Troubleshooting > CentOS 7.x lxc container creation fails due to host resolution

It is possible that CentOS 7.x container creation fails with errors similar to

[Errno 14] curl#6 - "Could not resolve host: centos.mirror.snu.edu.in; Unknown error"
Trying other mirror.

even though DNS is working fine. This is possible because lxc (unfortunately) uses DNS configuration from cache and not from host. That is lxc-create uses DNS configuration from

/var/cache/lxc/centos/x86_64/7/rootfs/etc/resolv.conf

for centos-7 containers. To solve the issue edit above file and add appropriate nameserver. If 4.2.2.2 and 8.8.8.8 are used then the settings should work at multiple locations without any problem.



Home > CentOS > CentOS 7.x > Virtualization > Lxc > Troubleshooting > CentOS 7.x lxc container creation fails due to host resolution