summaryrefslogtreecommitdiff
path: root/switching-to-lxc-lxd-for-django-dev-work-cuts.txt
blob: 5f128fef6b71df2c2a1a1d89ff9c1ff9216c76d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

Error: Failed to run: /usr/bin/lxd forkstart debian /var/lib/lxd/containers /var/log/lxd/debian/lxc.conf: 
Try `lxc info --show-log local:debian` for more info
Hmmm. Nothing like a error right after init. Okay so run that suggested command:

~~~~console
lxc info --show-log local:debian
If this is your first time running LXD on this machine, you should also run: lxd init
To start your first container, try: lxc launch ubuntu:18.04

Error: Get http://unix.socket/1.0: dial unix /var/lib/lxd/unix.socket: connect: permission denied
~~~~

I after a bit of searching I figured out the permissions problem has to do with privileged vs unprivileged containers. I skipped a part in the initial setup on Arch. Out of the box on Arch you'll need to jump through a few extra hoops to run unprivileged containers, which seem odd and even backward to me because as I understand it that exactly what you want to run. For now I have skipped those extra steps until I better understand them. In the mean time I used the workaround suggested in the Arch wiki, which is to append `-c security.privileged=true` to the end of the `launch` command we used a minute ago. However, I believe this defeats one of the major security benefits of containers, by, uh, containing things. So I wouldn

~~~~console
sudo lxc launch images:debian/stretch/amd64 debian -c security.privileged=true 
Error: Failed container creation: Create container: Add container info to the database: This container already exists                                                                                              
~~~~

Okay, so even though we couldn't connect in our previous effort, we did create a container with that name so we need to get rid of it first. Let's see what we have.

~~~~console
sudo lxc list
+--------+---------+------+------+------------+-----------+
|  NAME  |  STATE  | IPV4 | IPV6 |    TYPE    | SNAPSHOTS |
+--------+---------+------+------+------------+-----------+
| debian | STOPPED |      |      | PERSISTENT |           |
+--------+---------+------+------+------------+-----------+
~~~~

Yup, there's our debian container. Now the question is how do delete a container using the `lxc` command? Curiously, the command `lxc-delete`, which you'll discover if you type `man lxc` errored out for me. After a bit of searching I found the LXD equivelant is `lxc delete`:

~~~~console
sudo lxc delete debian
~~~~

Okay, not back to our create command:

~~~~console
sudo lxc launch images:debian/stretch/amd64 debian -c security.privileged=true
~~~~