Docker Container Has Internet Access Only in Privileged Mode

Hi

I am running Docker inside an LXD Debian container. The containers created have no internet access until I deploy a container with privileged access. Things like “apt update” don’t work inside the container until the container is privileged.

I really appreciate any help.

Thanks!

Could be docker firewall intefering with LXD’s DHCP server.

You’ve not provided any info on specifically what is wrong or your LXD setup so its hard to tell.

I don’t know if this is still an issue with the current LXD version, however have you tried this?
The link will forward you to a question about running docker inside LXD containers.

First of all, thanks for your prompt reply.

Well, I am trying to run VSCode container (Docker Hub). The container deploys fine but when I try to access the container with the server’s public IP after mapping the ports in the docker command, I can’t access the container. To check if the network is OK, I exec into the container and did ping and “apt update” tasks, both of them failed. Apparently, the container has no internet access.

When I deploy the same container with the –privileged option the container now has internet access and I could access it with my server’s public IP.

And, It’s just my doubt, if the docker firewall is causing the problem how can a privileged container get internet access?

Hello. Any update?

Please show lxc config show <instance> --expanded and ip a and ip r from the LXD host and inside the container.

Hello Thomas. I’m afraid I don’t have access to that information. I rented a VPS from a hosting provider who uses LXD as the hypervisor. For that info, I might have to create a support ticket with my VPS provider.

I created another post with some info from Docker. Can you have a look at this post, please?

Hi Thomas. I’ve managed to build an Ubuntu image with net-tools installed. When I create a container and execute “ifconfig” I see no interfaces. With a container with privileged access, I see eth0 interface (one of docker bridge IP is assigned).

@stgraber Can you please have a look at this?

This one too.