How to connect to lxd container

lxd is an easy-to-use command-line interface for lxc (Linux container). In this blog post, I will show how to create an lxd container and connect to it.

To create an lxd container, run

Here vm-1 is the name of the container. ubuntu:20.04 tells lxc to create a new container with Ubuntu version 20.04.

To see the list of containers, you can use the command

list lxd containers

This list IP address of the containers. If you have openssh-server installed and have a user name and password or SSH key set, you can login using the IP address.

If you just created the container, you don’t have any login, then you can use the command

connect to lxd container with lxc shell command

Another way is to use lxc exec

Example

If you have a login, then you can use the command

This command will give you access to the console of the container.

See lxd

Leave a Reply

Your email address will not be published. Required fields are marked *