A network related operation failed in a context of no network access

Do you have Docker installed?

Can you reproduce this with just lxc?

lxc launch ubuntu:24.04 c1
lxc shell c1 -- getent hosts snapcraft.io

Have you seen this thread?