$> diogo --notes-and-thoughts

LXD Getting Started Commands

Fri, 23 Sep 2016

LXC 2.0 released with Ubuntu 16.04LTS provides stable LXC containers, managed by a daemon service called LXD. But pay attention, this is not Docker, the concept is quite different.

In simple words, Docker is ephemeral like when you start a service. Or you can call that a way of packaging some service / server / application inside of a container that has all different libs, written in different languages. Who cares, its inside its own operation system.

LXC / LXD its more like any other virtualization technology, like KVM or VMWare. Just that you can have 10x the density (at least Canonical clames it). This is quite handy because its also 10x simpler to manage.

Applying Docker to Odoo deployment, i Maybe i would use it with some mechanism of spanning multiple machines under the same load balancer. This would allow maybe to serve more users in peek times. Of course that would mean that this would be a very big deployment and that the effort to orchestrate this would be less than the price of keeping the same machine always on waiting for the requests to come.

Bottom line, we would need a team to manage this possible Docker deployment. Now LXD/LXD provides container start , stop, copy, move (to different hosts), snapshot, image publishing. Mostly same, just it is a continuity concept. Container is seen like a server and not like a service, we can attach storage or use zfs to mirror data. In my perspective using Docker with Odoo for small and medium projects is a mistake, LXC and LXD is a better choice. Here are some commands to get you started.

# Take a snapshot
lxc snapshot c1 YYYY-MM-DD

# Restore snapshot
lxc snapshot c1 YYYY-MM-DD

# Create new container from snapshop
lxc copy u1/YYYY-MM-DD testcontainer

# Publish new image
lxc publish u1/YYYY-MM-DD --alias foo-2.0

# Edit image
lxc image edit foo-2.0

# Export and import compressed
lxc image export foo-2.0 foo-2.0.tar.gz
lxc image import foo-2.0.tar.gz --alias foo-2.0 --public

# Push file into container
lxc file push ~/db/dbdump.backup test:c1/root/file.backup

# pipe a folder into container
tar cf - ~/.local/shar/Odoo/filestore/v10_database | lxc exec host01:c1 -- tar xvf - -C /opt/odoo/data/filestore/v10_database

This entry was tagged as linux lxc lxd ubuntu containers