Skip to content

Instantly share code, notes, and snippets.

@AdamIsrael
Created January 25, 2017 11:15
Show Gist options
  • Save AdamIsrael/cc14131ed002038955fbcd678541e75c to your computer and use it in GitHub Desktop.
Save AdamIsrael/cc14131ed002038955fbcd678541e75c to your computer and use it in GitHub Desktop.
OSM SO UI plugin development - Bind mounts with LXD

This document is intended to aid the development workflow described in Developer HowTo for UI Module for Open Source Mano.

In order to develop in your preferred IDE/text editor, you can "bind mount" a directory from your local computer into an LXD container running on the same host.

First, find out your uid:

$ id
id
uid=1000(stone) gid=1000(stone) groups=1000(stone),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare),129(lxd),131(kismet),138(libvirtd)

On standard Ubuntu hosts, the uid of the first user is 1000. Now, we need to allow LXD to remap this id; you’ll need an additional entry for root to do this:

$ echo 'root:1000:1' | sudo tee -a /etc/subuid /etc/subgid

Assuming you have the SO in a container named SO-ub, set the idmap so that lxd is aware

$ lxc config set SO-ub raw.idmap 'both 1000 1000'
$ lxc restart SO-ub

Bind a local path to a path inside the container:

lxc config device add SO-ub plugindir disk source=/home/user/myplugin path=/path/to/skyquake/plugins/myplugin

Now you can make changes to the file(s) on your local filesystem and they will be mirrored inside the container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment