Intro to LXC, LXD, & Linux Containers

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Also check out the LXD subreddit /r/LXD

👍︎︎ 4 👤︎︎ u/bmullan 📅︎︎ Dec 15 2016 🗫︎ replies

Is there LXD for fedora, centos or any rpm based Linux? (I didn't watch the video yet)

👍︎︎ 3 👤︎︎ u/theawesomeviking 📅︎︎ Dec 15 2016 🗫︎ replies

I'd there something similar to a Dockerfile

👍︎︎ 1 👤︎︎ u/pure_x01 📅︎︎ Dec 15 2016 🗫︎ replies
Captions
so let's talk about Linux containers now that might seem like an over generalised statement but we're going to talk about LX c and LX d and LX c literally stands for Linux containers so if containers are a new concept to you you could compare them to FreeBSD jails or simply at root all a container is is the type of virtualization specifically operating system-level virtualization now recently I've been talking about virtualization in terms of system hypervisors and VMware and VirtualBox and things using containers as another type of virtualization is a little bit different because you're not virtualizing the hardware at all instead you're more or less virtualizing the software environment that the application or applications run in in most circumstances the applications inside of the containers aren't even aware that they're running inside of a container or even aware of the host OS LXE in particular uses a feature inside the Linux kernel called cgroups which provides namespace isolation and that provides a mean for isolating resource usage security and a whole bunch of other stuff so let's start off by showing you kind of how I use LXE so it's worth pointing out that this is LX C version 2 with lxd if you're trying to use LX C on a distribution that isn't in boon to you're probably using regular version 1 LX C which uses libvirt which provides different functionality and the commands and things you see in this video won't necessarily translate over so right now I'm SSH into the eg i/o game server and you can see that the game servers themselves are running within LX c containers by doing LX c list you can see this really nice little table of each container that's running along with the state the IP address the type of container and snapshots so there's all sorts of stuff that you can do here and one of the most awesome things about LX C is the API the API is absolutely fantastic like if I wanted to see what config did I can just double tap config and I can dig a little bit deeper and do it this way limits memory so now we see that the memory limit for the rest server is 1 gigabyte so let's go ahead and increase that so rather than do a get we're going to do a set and let's increase it to 4 gigabytes so now we can go to the rest server do a chop and now you can see here that we have for gigs now we only have two processors so what if we want to have four processors so that is pretty much the exact same thing so we'll go back and set limits I think it's CPU and we'll do for now let's go back into the rest server and now you can see that we have four and you can see for a rust server it's using five hundred and eighty megabytes that's ridiculously low and that's because since this is running inside of a container all this container is doing right now is running rest so this is vastly superior than running it on a physical server which could have all sorts of other services and processes running and likewise with the other servers so now might be a good time to take a snapshot of the minecraft server so let's do that snapshot minecraft vanilla and I think that you give it a name so this is the third one so there you go now we have a backup if we do Aleksey list now we have three snapshots just like that and if you want to restore it I can't remember the syntax if you just type it it'll say here's an example of the syntax so the API is incredibly easy everything is very fluent and very quick so that kind of gives you an idea of an actual use case for lxc I needless to say if you want to join our game servers you can go to eg I out the website find out more information there let's try making a new container on my local machine because I don't want to screw around with game server so I already have two machines here I have one called backups which actually did nothing so let's go ahead and delete that and just like that that machine is gone I don't know if there's a way to restore it probably not but that machine has been deleted in the disk space has been restored similar to the way docker works lxc actually has a collection of images that you can use for your base container and you can see that these aren't all in boone - or debian based you've got fedora in here you've got Oracle in here you've got Alamo which I'm not familiar with Alpine seems to be a pretty popular one but I know that everybody loves Arch so let's try to pull down an arch box so that means we should be able to do lxc launch arch linux arch test so i had to double-check in my syntax was wrong so it's actually LXE launch images arch linux arch test there we go so if you're trying to create a container using ubuntu I guess the in boom two images are pre stored in lxd if you're using anything else you have to reach out to the image repository which is what that images colon is so if we do lxc list we'll see an arch test box running now notice how the IP address is 1.99 that's being issued by my router and that's because my default profile is set to do that by default I believe LXE uses a bridge which means that the containers are not publicly accessible but because I'm running game servers and obviously I want them to be public accessible I had to change the networking strategy to accommodate that that was not difficult so now let's dive into the container and I know that I haven't talked about this but I've done it a few times to execute anything inside of the container you do lxc exact and then the name of the container and then the name of the command I believe that it automatically looks in slash bins so technically anything that's in bin will work but I'm going to run bash here and now we are in the container we go to slash you see that this is just a normal file system there are no users so if you want to put a user in here and if you're going to do anything you really should by default everything is running under the root user let's just go ahead and download something specifically let's download h top and needless to say since this is an arch box it's going to have all of your regular arch applications if there are regular arts applications I guess pac-man there's other ones like IP is in here and all the regular canoe utilities and things like that it's all kind of built in so effectively this is a nano operating system so as we can see H top we see that by default the container is using everything that the system has so we have all four cores we have 14 gigabytes of memory and a whole lot of swap you see these processes kind of switching on and off those are related to lxc and managing the container everything else is pretty much system D and bash that is pretty much it so this container is ready for anything we can throw at it but I think that I'm going to stop the video here because this is meant to be sort of an introduction video I don't want to dive too deep though there's a lot more stuff that we can do so we'll stop this container and we will delete the container so if you have any more interest in lxc and lxd and what it can do in more advanced use cases let me know what you guys think in the comments
Info
Channel: Egee
Views: 41,658
Rating: 4.9028831 out of 5
Keywords: lxc, lxd, docker on ubuntu, chroot, bsdjails, linux container, lxc ubuntu, lxd ubuntu, cgroups ubuntu, cgroup, containers on ubuntu, chroot ubuntu, chroot fedora, freebsd jail, bsd jail ubuntu, docker on linux, docker on windows, docker on macos, linux hypervisor, docker hypervisor, lxd hypervisor, docker in lxc, lxd linux, linux, linux lxd, linux containers, linux lxc, lxd container, containers linux, lxc lxd, lxc linux
Id: qJoKrHXUAgI
Channel Id: undefined
Length: 6min 52sec (412 seconds)
Published: Wed Dec 14 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.