How to know you are inside a LXD container?

You have access to a virtual machine, you need to find out what virtualization technology it uses, you can install virt-what

apt instal virt-what

Then run virt-what command, it will show what virtualization technology you are using.

root@mysql-1:~# virt-what
lxc
root@mysql-1:~#

Another way to find is using the command. If you use LXD container, you will see the following files/directories.

Advertisement

root@mysql-1:~# ls -la /dev | grep lx
-r--r--r-- 1 root   root          37 Jun 30 21:15 .lxc-boot-id
drwx--x--x 2 nobody nogroup       40 Jun 30 21:15 .lxd-mounts
drwxr-xr-x 2 nobody nogroup       60 Jul 12 17:13 lxd
root@mysql-1:~#

Also mount command will show many lxcfs mounts.

Identify LXD container
Add a comment

Leave a Reply

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

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement