Now that you know the basics, here are some useful commands for managing your container from the Termina shell.
Start a stopped container:
lxc start u1
Stop a running container:
lxc stop u1
Enter the container shell:
lxc exec u1 -- bash
List all available containers and their status:
lxc list
Delete a container (permanent action):
lxc delete u1
Print additional container information:
lxc info u1
Example output:
Name: u1
Status: RUNNING
Type: container
Architecture: aarch64
PID: 24141
Created: 2025/08/07 04:46 EDT
Last Used: 2025/08/07 04:46 EDT
Resources:
Processes: 120
CPU usage:
CPU usage (in seconds): 384
Memory usage:
Memory (current): 1.58GiB
Memory (peak): 4.86GiB
Network usage:
eth0:
Type: broadcast
State: UP
Host interface: veth7df9a2e6
MAC address: 00:16:3e:18:59:08
MTU: 1500
Bytes received: 1.28GB
Bytes sent: 6.11MB
Packets received: 308930
Packets sent: 83115
IP addresses:
inet: 100.115.92.202/28 (global)
inet6: fe80::216:3eff:fe18:5908/64 (link)
Add the Google Debian container to your list of containers you can install:
lxc remote add google https://storage.googleapis.com/cros-containers --protocol=simplestreams
List the remote containers:
lxc remote list
Example output:
+-----------------+------------------------------------------------+---------------+-------------+--------+--------+--------+
| NAME | URL | PROTOCOL | AUTH TYPE | PUBLIC | STATIC | GLOBAL |
+-----------------+------------------------------------------------+---------------+-------------+--------+--------+--------+
| google | https://storage.googleapis.com/cros-containers | simplestreams | none | YES | NO | NO |
+-----------------+------------------------------------------------+---------------+-------------+--------+--------+--------+
| images | https://images.linuxcontainers.org | simplestreams | none | YES | NO | NO |
+-----------------+------------------------------------------------+---------------+-------------+--------+--------+--------+
| local (current) | unix:// | lxd | file access | NO | YES | NO |
+-----------------+------------------------------------------------+---------------+-------------+--------+--------+--------+
| ubuntu | https://cloud-images.ubuntu.com/releases | simplestreams | none | YES | YES | NO |
+-----------------+------------------------------------------------+---------------+-------------+--------+--------+--------+
| ubuntu-daily | https://cloud-images.ubuntu.com/daily | simplestreams | none | YES | YES | NO |
+-----------------+------------------------------------------------+---------------+-------------+--------+--------+--------+
Using the images
remote you can create a container with images from
Linux Containers
.
For example, to start Alpine Linux 3.22:
lxc launch images:alpine/3.22 a1
From the Termina shell, configure the container to start automatically when you start the Linux development environment:
# Set the container to start automatically
lxc config set u1 boot.autostart true
# Set the startup priority (lower number means higher priority)
lxc config set u1 boot.autostart.priority 1
Once you have a container configured with your preferences, you can save it and use the backup to create new containers.
First, stop the running container to ensure a consistent state:
lxc stop u1
Save the container to a compressed tar file using the export
command:
lxc export u1 my-ubuntu.tar.gz
Save the backup file to your Google Drive or another easy-to-access location.
Import the backup file to create a new container:
lxc import my-ubuntu.tar.gz u2
Now you have a fresh container named u2
at the same state you saved the backup.
For a smoother experience, especially on devices with limited resources, you can monitor and manage your container performance.
Configure resource limits for your container from the Termina shell. This can prevent the container from consuming too many system resources.
Limit the container to 4 CPU cores:
lxc config set u1 limits.cpu 4
You can confirm using the Linux lscpu
command. On an 8-core system you will see four cores moved to offline.
Limit the container to 2 GB of RAM:
lxc config set u1 limits.memory 2GB