Container Configuration



Location of Important Files



# List of container shell scripts
cd /usr/share/lxc/templates/
ls


# List of existing containers
cd /var/lib/lxc
ls

# root fs of a container
cd /var/lib/lxc/my_first_container/rootfs
ls


# mount something inside fstab
cd /var/lib/lxc/my_first_container/fstab


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sample Configuration


• Reboot to make the changes take effect

# Add the following to /var/lib/lxc/my_first_container/config

# Configure a Static IP Address
lxc.network.ipv4 = 10.0.3.100/24 10.0.3.255
lxc.network.ipv4.gateway = auto                 # use vbridge

# Auto start
lxc.start.auto = 1
lxc.start.delay = 15        # for the next container to start (in sec)

# Boot order
# Higher number starts first
lxc.start.order = 10

# Container grouping
# if set, auto start is ignored
# lxc.group = infrastructure,dns


# Disable ip address allocation via dhcp in container
lxc-attach -n my_first_container
nano /etc/network/interfaces
# comment out iface eth0 inet dhcp


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Test Boot Order & Delay



# List the boot order
lxc-autostart -L

# Run autostart
lxc-autostart -a


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Further Reading



man 5 lxc.container.config



Index