Skip to content
Giuseppe Corti edited this page Mar 1, 2020 · 10 revisions

Creating a container

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.

Start your new container

You can start your freshly created container with:

# lxc-start -n mycontainer

Get container's informations

It is possible to get some useful informations about your container such as state, pid, cpu usage, memory usage and kmem usage as follows:

# lxc-info -n mycontainer

Attach to your container

to start a shell session on "mycontainer"

# lxc-attach -n mycontainer

Stop your container

# lxc-stop -n mycontainer

Freeze your container

It is possible to freeze containers in order to save battery life when unused as shown below:

# lxc-freeze -n mycontainer

Unfreeze your container

You can then restore your container state with:

# lxc-unfreeze -n mycontainer

Destroy your container

# lxc-destroy -n mycontainer

References

Clone this wiki locally