Notes for LXC Container Management on Ubuntu 14.04

LXC stands for Linux containers.
It’s something like VM/Hypervisor, and more lightweight and easier to manage. You can refer to common commands to manage your LXC containers as follows:

Launch New Container

lxc launch ubuntu test-container

Attach to Container

lxc exec test-container /bin/bash

List Container Network

lxc network list

Attach Container to Specific Network

lxc network attach lxcbr0 test-container

Attach Host Directory to Container

lxc config device add test-container sda disk source=/containers/test path=/mnt

Enforce Memory Usage of Specific Container

lxc config set test-container limits.memory 4G
lxc config set test-container limits.memory.enforce hard


  • if you found your container cannot start correctly after upgrading your lxd/lxc (and got something like invalid config value). such issue usually caused by compatibility issue. you’d better check /var/lib/lxd/lxd.db. this file is a sqlite3 database, and you can fix it manually like:
update containers_config set value=’32GB’ where id=1
Show your support

Clapping shows how much you appreciated Hambster’s story.