Creating and using your first LXD container
To create your first basic LXD container, run the following:
ken@monster:~$ lxc launch ubuntu:24.04 first-ubuntu-noble
The lxc launch command requires at least two arguments: which image to base the container on and a name for the container you create.
In the previous example, we created a new container named first-ubuntu-noble based on Ubuntu 24.04.
The lxc launch command creates and starts a new container instance. To access the instance, you will need to open a shell in the instance in your terminal:
ken@monster:~$ lxc exec first-ubuntu-noble -- bash
root@first-ubuntu-noble:~#
The lxc exec command will execute any command specified in the container. We must execute a shell of our choice to get a shell in the container, run commands, and install software. In the last example, we executed bash, a popular Linux shell, as the root user. This is fine for installing software and configuring and running system services...