Library for launching and configuring LXD containers based on pylxd

Intro

Hi,
I have created this thread to ask for advice about a library I started working on for automatic container creation and configuration using pylxd. The current stage of my library satisfies my use cases, but I would wish to develop it further and I would like to know what the community thinks about it.
If you want to check out my project you can find it here: cristi-bourceanu/pylxd-dev.


Motivation

Reasons for using LXD

I am working on different projects (personal, university or work) and sometimes package versions collide between these projects.

Code I once wrote does not run anymore because of libraries and path related issue and configuring the system again for it takes unnecessary time. Instead we could take a snapshot of the container where we developed that code.

When learning to use a new framework, this comes with installing new software and some trial and error until you find the right configurations.

There are a great deal of projects on github that may be useful for your needs, but many you need to compile and match to some dependencies. Nobody wants to install lots of bloatware and then remember to handle removing what they don’t use.

Motivation for automatization

I have started handling this issues with the help of containers. However, the manual way to setup the containers with the CLI tool is too time consuming if you are doing it multiple times.


Solution

Gratefully, LXD has an API for Python called pylxd which we can use to write scripts that can launch and configure our containers.

The library I wrote creates a container of a given image alias, loads and runs scripts provided, sets security.privileged if needed and mounts given directory paths from host to /home/ubuntu.

I guess a similar functionality could have been done in a shell script using the CLI tool, but I believe that Python enables easier future development.

Could you let me know what you think about this and how do you believe I can improve it?