From 41d5367448cd69158a61cf4e022baf803b157af7 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Mon, 8 Apr 2019 13:46:39 -0500 Subject: added src articles --- switching-to-lxc-lxd-for-django-dev-work-cuts.txt | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 switching-to-lxc-lxd-for-django-dev-work-cuts.txt (limited to 'switching-to-lxc-lxd-for-django-dev-work-cuts.txt') diff --git a/switching-to-lxc-lxd-for-django-dev-work-cuts.txt b/switching-to-lxc-lxd-for-django-dev-work-cuts.txt new file mode 100644 index 0000000..5f128fe --- /dev/null +++ b/switching-to-lxc-lxd-for-django-dev-work-cuts.txt @@ -0,0 +1,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 +~~~~ -- cgit v1.2.3-70-g09d2