LXC/LXD as an alternative to Virtualbox for local development

Strange.

Seems like a problem with paths.

Do you have apparmor installed?

Yes this is strange, and no i have not installed apparmor. There isnā€™t any executable command file for lxc under /usr/bin/ either. And what is this!! linux mint site is also down no support nor forum :frowning:

I think i should try ubuntu 15.* for testing now. This is no good.

Well for what itā€™s worth, Ubuntu is the reference platform because Canonical are driving the development of LXD. Iā€™ve had no problems using this stuff at all.

Iā€™m running 14.04 but will upgrade to 16.04 as soon as itā€™s out.

The officially supported ZFS in 16.04 is going to make LXD fly.

hello again treb0r , I have Ubuntu 15.04 desktop version now. Unfortunately while trying to add remote images i get following error message.

lxc remote add images images.linuxcontainers.org

error: remote images exists as https://images.linuxcontainers.org:8443

What does it signify. I searched web for this issue but could not find proper answer. Could you please help me on that?
Thank you

Looks like images is already configured. Try running:

lxc remote list

You should see something like:

+-----------------+-----------------------------------------+--------+ | NAME | URL | PUBLIC | +-----------------+-----------------------------------------+--------+ | images | https://images.linuxcontainers.org:8443 | YES | | local (default) | unix:// | NO | +-----------------+-----------------------------------------+--------+

In which case youā€™re good to go.

1 Like

Thanks treb0r.
Yup it is as you said they are already configured.
But strange thing is I checked it earlier and it was empty. Just before you replied i also added PPA repository which i thought was not necessary on 15.04 and I am pretty sure it was not the case for my error message.

Thank you once again.

No problem. I personally prefer to stick with LTS releases and I think things will be smoother once 16.04 is out.

Let me know how you get on or if you need a hand with it.

Just a quick heads up that LXD is now at version 2.0 and there have been some major changes to how networking is configured.

Iā€™ll post details here and Iā€™m planning to do another blog post soon.

2 Likes

The authoritative guide to LXD networking in version 2.0, hot off the press:

I couldnā€™t get the setup wizard to work so I followed the instructions and edited the config file directly. Now itā€™s all working fine.

hi there,

I have a Github issue on LXD "Synced Folders"

I am super interested in working through to some kind of working solution on this

for me there are two big LXD issues, networking and synced folders

I know both can be done, but I read many options

perhaps an Ansible role or two would work well for this as it seems out of scope for LXD according to LXD maintainers

added another question / issue to the LXD networking blog

I donā€™t see an issue with either of these.

Synced folders do require global write permissions on the host system, which is obviously not ideal, but apart from that it all seems to work fine.

LXD networking has been in a state of flux and last week they moved away from LXC networking entirely as described in that blog post.

After having a few problems with the setup process I just edited the config file directly and now itā€™s all working nicely.

The vision is to get this working properly with Vagrant and then packaged as a proper alternative to Virtualbox for Trellis. This has been difficult because LXD itself has been a moving target recently, particularly the networking stuff.

Iā€™m hoping things will settle down a bit with the release of 16.04.

1 Like

I got synced folders working with the following script.

It sets up subuid/gid map for your uid, and then creates a custom profile for you user that you can use with lxc launch.

Seems to work well for me, and is very flexible.

1 Like

That looks way cool.

Iā€™ll give it a go, thanks!

Do I need to pass anything in to lxc launch to get this to work?

I am new to this community. I am very excited about the roots ecosystem, but while going through the Trellis tutorial, I fell down on the Vagrant / Virtualbox set up. It turns out that my laptop, running Ubuntu Trusty, would not run a Virtualbox VM because its hardware doesnā€™t support it. Then I stumbled across your post and started learning about LXC/LXD. It works just fine on my laptop.

While researching, I discovered that there is a custom Vagrant provider plug-in for LXC https://github.com/fgrehm/vagrant-lxc. I havenā€™t tried it yet, I am still in LXC/LXD learning mode (and I want to get through your tutorial on the manual setup) as well. I donā€™t know if you have tried this yet. I intend to, after I gain some familiarity with the toolset and configuration. I did want to let you know about this.

2 Likes

Hey @chipk great to hear you have LXD working!

I have seen the Vagrant provider plugin for LXC but unfortunately it wonā€™t work with LXD (as far as I can tell anyway).

I owe the roots guys another blog post about this stuff, this time about using Vagrant with LXD but have struggled to find enough documentation to get it working properly.

Having said that, I have been making progress and have been in touch with Canonical about a couple of issues. A few tips for getting up and running manually without Vagrant:

That gist from @bloodearnest above will allow you to mount a shared directory without the need to make the target directory world writable.

Also, before provisioning your dev environment, check out this thread:

ā€¦and make sure to add back those sudoer password definitions.

Let me know if you need a hand.

1 Like

Wow! The learning curve on LXC/LXD has been circuitous, and required me to get my head around a lot of concepts. I am beginning to see daylight, though. Anyway, I just wanted to let you know I saw your response and thank you for your guidance and offer of assistance. I will update you when I get to the point of having Trellis working, and I definitely will take you up on your offer of help if I get stuck.

2 Likes

This is some great info. Iā€™m just getting to the point where I am doing enough small WordPress sites for customers that I need a more streamlined solution than what I have been doing, which is creating individual KVM instances for each site based on a few default instances I have already created. VVV sounds great but I hate having to switch to Virtual Box and donā€™t have time at the moment to figure out if I can make it work with KVM. Have you made any further progress on getting LXD and Vagrant working together?

Unfortunately not.

Iā€™ve found that just working with the LXC/LXD tools in combination with trellis gives great results. I just setup the .dev domains in my local /etc/hosts file and handle everything manually. I like the control that gives and donā€™t really feel the need for Vagrant anymore.