Access nested docker container by IP


I am running docker-ce within an lxd container. LXD is hosted on Manjaro. What I’m looking to do is to be able to run front-end (gui) applications on my Manjaro installation which access the nested docker container by IP address.

I’m not sure if that’s achievable or not? I could of course run several lxd containers but I wanted to experiment to see if I could just run nested docker containers instead.

I’ve done some research but was getting a bit confused! It looks like I may need to use the macvlan networking but not sure if that is valid for my use case.


My (limited) understanding of docker is that it uses port-forwarding from the ‘host’ to expose services into the container.

In your case the ‘host’ would be the LXD container’s IP.

In the default LXD network setup, this means each container gets a private IP on the lxdbr0 network, which is not exposed to the wider external network.

There are various ways to configure LXD containers to join the external network depending on your local setup and needs.

Do you need to share your container onto the external network, or do you just need to access the docker container services from your host machine?

Thanks for your response. What I would like to do is to access docker container services from the host machine. So for example, if I have an oracle docker container running under the LXD hypervisor and I wanted to use sqldeveloper on my laptop to access the oracle instance running in the docker container, what would I need to configure to be able to connect? I’m only giving oracle and sqldeveloper as an example here.


So that should work by using the container’s IP on lxdbr0 network assuming you have setup your docker container to forward the needed ports from your LXD container.

Thanks! I guess I was overthinking it! I thought I needed to expose the docker IP address as well.

I just exposed the port from the docker container and this gets “pushed” upwards through the lxc container to the LXD hypervisor and ultimately to my desktop application running on my Manjaro installation.



1 Like