# LXD LXC

## What is LXD/LXC?

LXC, short for Linux Containers. To understand LXD you first have to understand LXC.

**LXC** is a solution for virtualising 'software' at the operating system level within the Linux Kernel. Traditionally we would have had a physical machine to run a single Operating System on it. One way to go over this limitation is to use 'virtualisation' to spin up multiple operating systems (virtual machines aka "VM's") on a server.\
Virtualisation is good but it takes up system resources. It also needs the CPU to handle virtualisation,VTx for Intel, and AMD V for AMD.\
Different types of hypervisors such as KVM, HyperV, VMWare, Virtual Box and XEN can be used to spin up and manage these VM's.\
The lightweight solution to these VM's is 'Linux Containerisation' whereby&#x20;

![](/files/-M6G222i1-hPGOoOybv6)

![](/files/-M69U2RiFW5i75yBeKb-)

If running Ubuntu 18.04, LXC/D are installed by default - otherwise just install

![](/files/-M69Vwn9fmyOm0npO66v)

The LXD daemon by default is loaded but not started (inactive)

![](/files/-M69WkBhr7Z69TbuTAiy)

```
$ getent group simpsons
simpsons:x:742:homer,marge,bart,lisa,maggie
```

The fields, separated by `:`, are—

1. Group name (simpsons)
2. Encrypted password (not normally used) - x
3. Numerical group ID - 742
4. Comma-separated list of members - homer , marge, bart, lisa.maggie

{% hint style="success" %}
If you are running services that require you, as a user, to run commands in elevated mode.ts better sometimes to just add the user in the to the same group as the service
{% endhint %}

```
mike@vm1:~$ sudo getent group lxd 
lxd:x:108:ubuntu

sudo usermod -aG lxd mike

mike@vm1:~$ sudo getent group lxd
lxd:x:108:ubuntu,mike 
```

To start up a new instance :

![](/files/-M69uYy3zfvwWV_28o0e)

From the above, one of the questions was :"Would you like stale cached images to be updated etc" \
What this means is that  LXD will check the image repository for new updates of the image. We can check what current images are available

![](/files/-M69vjMT6cQvjJz8_hUj)

If we want to install Debian on this container we can check what images we currently have using and we can see we dont have anything installed as of yet.

![](/files/-M69wPVnwLnqEDobc1XN)

So we run

```
ubuntu@vm1:~$ lxc image list images:debian | more
or
ubuntu@vm1:~$ lxc image list images: | more
```

![](/files/-M69y4eQcSaEqpIKxJmQ)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://linux.microcisco.com/containers/lxc-lxd.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
