Link to home
Create AccountLog in
Avatar of gopher_49
gopher_49

asked on

Running Docker Inside A LXC Container - Bridged to existing LAN

My LXD host is running Ubuntu 17.04.  I created a bridged interface and set that interface as the default network for all LXD containers...  This results in my containers being on my LAN..  This works just fine, however, I'm now trying to run Docker inside a LXD container.  My goal is to place all Docker container on the same LAN.  How can I create a Docker network to be on the same LAN while nested on a LXD container?
Avatar of David Favor
David Favor
Flag of United States of America image

First, I'm unsure why you'd dockerize your apps since your running a container already.

Simple solution is don't run docker. You're already containered using LXD.

That said, if I had to debug this, I'd first check my networking in my docker container.

Likely it's some minor routing problem. You'll have to arrange for your packets to flow through your LXD network stack to your machine network stack.

How this is done is highly dependent on all commands you issued to get to where you are now.

Also, keep in mind, all work you do on Zesty, will likely require a complete rethink, when you upgrade to Artful or Bionic, as both these scrape current networking + switch to using netplan (shudder).

If at all possible, skip docker + just run your application native in LXD.

If you must run docker, then install tshark... let's see... I'd likely install it at machine level + compare how packet flow was working from LXD to machine + how it was broken when flowing from docker to LXD.
Avatar of gopher_49
gopher_49

ASKER

The thing is this..  Developers/vendors sometimes ship applications via Docker... I can run one command and deploy a complex application..  Now..  Docker natively is a problem for me..  This being due to the fact on one VM I wish to run a different versions of different PHP, MySQL, and even different VLANs/networks...  So.. This is where LXD containers make sense..  The perfect scenario will be to run LXD containers and then pull Docker images down to in return create Docker containers nested in  a LXD container.  I'll build a lab for this.. I have a use case...
ASKER CERTIFIED SOLUTION
Avatar of David Favor
David Favor
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
After reviewing this further I agree 100%.  If I have a Developer that wants to work in docker I'll spin up a dedicated VM for his use... That single VM will be for his docker apps..  I'll create my own registry and the developer can package and ship directly to me across the datacenters securely.  Other than that I'm sticking with LXD containers.  They are awesome...  I already moved 4 x network appliances and my Atlassian Confluence app within one VM that is the LXD host. I saved 6 GBs of RAM already..  And..  It's easier to manage for in the past I would have to add each VM to my VEEAM tape backup job, VEEAM disk to disk job, and Nimble Storage snapshot job.  I have so many VMs it becomes hard to manage.  This one LXD host will end up hosting 10+ network appliances and my Atlassian Confluence app...  I built a series of bridged NICs that present the container to their respective vSwitch in vSphere.  I don't see any performance hit either...  Now..  In my other environments where I don't have Hypervisor access I'll be able to create my own nested Hypervisor and give myself an experience I didn't have before...  This being environments where I lease VMs on a per month basis...  The fact I'll be able to take snapshots nested on someone else's Hypervisor is golden...  In the past I would have to open a ticket with the data center and request a snapshot for ease of roll back...  In addition to that no more creating VMs on their Hypervisor...  I'll just spin up a container..  I love it...  LXD is amazing and to be honest so is Windows Containers.  Once their Linux kit is in production I'll be doing a lot in Windows Containers...
Oh certainly yes.

I didn't think you might have been referring to some developer asking for this type of setup.

Yep, for me LXD resolved all my client hosting problems + allows me to run a large hosting company with a handful of people.

Before LXD, if one site had run away resource usage, determine the site + exact problem was complex + time consuming.

With LXD, these types of problems tend to be faster + simpler to resolve.