-
Notifications
You must be signed in to change notification settings - Fork 2
Usage
Creating a linux container on sailfishOS is as simple as:
# lxc-create -t sfos-download -n mycontainer
The download template will show you a list of distributions, versions and architectures to choose from. A good example would be "debian", "sid" (unstable) and "arm64".
It is possible to skip shell interaction by providing parameters to sfos-download as shown below:
# lxc-create -t sfos-downlaod -n mycontainer -- --arch armhf --dist debian --release sid
For your first LXC experience, we recommend using a recent supported release, such as "debian sid/bullseye", "ubuntu bionic/cosmic".
After container's creation completed, you'll find the container config file on /var/lib/lxc/mycontainer/config and the container rootfs directory inside /home/.lxc/mycontainer.
sfos-download template is configured by default to store LXC's downloads cache inside /home/.lxc/lxc_cache, it is safe to delete this directory after creation in order to free up some storage.
You can start your freshly created container with:
# lxc-start -n mycontainer
It is possible to get useful information about your container such as state, pid, cpu usage, memory usage and kmem usage as follows:
# lxc-info -n mycontainer
to start a shell session on "mycontainer"
# lxc-attach -n mycontainer
# lxc-stop -n mycontainer
It is possible to freeze containers in order to save battery life when unused as shown below:
# lxc-freeze -n mycontainer
You can then restore your session with:
# lxc-unfreeze -n mycontainer
You can save the current state of your container as a snapshot to restore it later or create new containers from it:
# lxc-snapshot -n mycontainer mysnapshotname
# lxc-snapshot -n mycontainer -L
To restore a previous snapshot (beware, this will overwrite the current state of your container unless you created another snapshot of it):
# lxc-snapshot -n mycontainer -r mysnapshotname
Optionally, you can create a new container from the snapshot with the following command instead of altering the parent container:
# lxc-snapshot -n mycontainer -r mysnapshotname -N mycontainer2
# lxc-destroy -n mycontainer