LXC/LXD vs Docker Which is better?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] so [Music] welcome back once again last time we talked about the anatomy of a lexi lexi application in the self-hosted environment and we discovered that it was basically like installing an application from the command line on a bare metal host this time we're going to take a little bit different angle and we're going to talk about lexi lex d versus docker which one is actually better well use the right tool for the right job docker is a completely virtual installation of an application that can be started with a single command docker is not persistent only mounted file folders are persistent docker containers are never upgraded they are replaced lexilexd is a virtual os instance that can be used to install any application and let's see lexd uses the kernel of the host in the host services unlike a virtual machine lexilexd does not virtualize the hardware so networking with containers both lexi and lexd can use nat networks so this is a screenshot from my qnap container station what they call network and virtual switch display and you can see in this display that there is a container network that's called docker 0 that is in that network it's running at 10.0.5 and there is a container network for lex c which is lex cbr0 and it's running at 10.0.3.1 and you can see that off to the right hand side here they don't really seem to go to a physical adapter and that's because exposing those containers from the net is purely a choice of the individual implementation of the container so docker likes to leverage nat by default the port section of a docker compose yaml file or the uh docker run command line so here's an example of uh the yaml file and here's an example of a docker run command line just excerpts from both of those the port number to the left of the colon is the port number to expose outside the docker nat network you may change it to any port number that the docker host is not using the port number to the right of the colon is the port number that's actually used inside the dock or nat and actually used by the application code never change it or else you're gonna break the application when you're trying to deploy it both lexi and docker can use nat it's more common to see docker use nat and for lexilexd to bridge to the host network so docker docker volumes must mount persistent volumes and folders inside of a docker volume do not store persistent data as i mentioned earlier between restarts of the container so when you restart a docker container if it's not mounting any data outside and it has persistent data that data is lost instead the volumes director in docker compose or the dash v and the docker run command line can mount persistent storage outside of the docker container itself so here's an example of what it looks like with the docker compose here's an example of what it looks like with a docker run so the value to the left of the colon is the folder outside of the docker container on your docker host so in this particular case a lot of times when you look at these documentation for docker containers they'll say things like slash path slash two slash app data just showing you that's that's what you're supposed to do you're supposed to change this path to pointing to wherever you want on your host to store the data and inside the container that's simply called slash config so right the value to the right of the colon is the name of the folder or mount point that's referenced in the docker container and it cannot be changed so what are some docker container generalities well docker downloads an image from the docker hub at https dot hub.docker.com the image has to reside on your local machine where docker is running for as long as you have a docker container that is using that image image is downloaded and a container instance is creating user using either that docker compose command or the docker run command a docker compose command requires a docker-composed or a dockercompose.yaml in the same folder where the docker compose command is executed so what are the downsides to docker well you have to completely destroy and recreate a docker container to upgrade to a newer version of an application persistent data must be externally mounted as we discussed and then sometimes containers get or container images get orphaned having no current container that references them an example is you create a container and later you go bring the container back down or delete it but the actual image that created the container still cluttering up your system if you don't need it so read carefully often docker containers have dependencies on other docker containers especially database instances which might not be part of the author's docker container so you know if you read out there a lot of times they'll say hey this relies on an external um my sequel instance and it's going to expect the following from that database they may ask for database location and a database username and password so that's what i'm talking about so what are the upsides to docker well they're simple and easy to run since an entire application is complete inside of the container the author creates this thing to be highly portable and easy to run so here's an example of a docker yaml file and a docker cli with the run command so there's a docker yaml file and i want to point out that you see all this indentation that's another thing a new docker users will frequently have problems because they won't get the indentation right spacing and blank spaces and tabs are extremely important in a yaml file if they are not in the right place they will result in a syntax error and then the docker run command which is simply a command line to go run your docker container and i might point out also that both of these can be run kind of real time to see if the container deploys correctly and then they both have the ability the docker compose has a dash d which means detach and the docker run has a dot a dash d which means detach and a detach process will be one that runs uh independent of the terminal where you started it and also it will automatically start on the next reboot of the docker host as long as the restart is set so what are some lexi lexd generalities well lexilexd is an image of a linux os not an image of an application a container image is downloaded rather than an os being installed from an iso so like in the case of a virtual machine you'll download an iso and do an installation of the operating system just like you would do an installation of an operating system on a bare metal machine containers don't work that way you download the os image and it is instantly available in instantly running so lexilexd is not just an os so or rather it is just an os so that all applications must be installed from scratch as they would be on a bare metal machine so lexi and lex d can use nat also but more commonly is bridged to a lan and they appear to be regular machines just like virtual machines or bare metal machines would be so lexi lexilexd containers can be upgraded unlike docker you can upgrade the operating system in them uh you can upgrade the applications in them i actually created a lxd container one time or lexi container one time uh in ubuntu 1804 and i upgraded it to ubuntu 2004 just to see if it could be done and it worked fine so what are the downsides to lexi lexd well you have to install the entire application in all dependencies just as though you were on a bare metal machine it's not like docker where you download you just run the container and everything is up and running so nothing is pre-built except the os and for that reason i would say consider creating templates in the previous video we talked about a lexi container that might have a lamp uh template pre-installed lamp template so let's see lexi didn't container share the kernel of the host machine if the host kernel is missing a required feature lexi lexd may not work for you so i've seen older kernels that don't support c groups even fairly new kernels that don't support wireguard so if you need a capability in the kernel you're going to have to either if it's not in the kernel of your host machine you'll either have to find a way to upgrade that kernel of the host before you create your container that needs that requirement or you're going to end up installing on a virtual machine which makes the kernel and software so lexi command line interface is more complex than lex d consider managing lex c and lex d with proxmox or qnap consainer station or even vmware so what are the upsides to lexilext well it works like a virtual machine it's faster and leaner than a virtual machine because no hardware virtualization and it's not as resource intensive because generally you're setting caps for resources like memory and cpu as opposed to carving a piece of the host machine out that's reserved for a virtual machine and lexilexd lets you install and upgrade any application from scratch just like on a physical machine so in summary again as we started out with pick the right tool for the right job docker containers are easy to deploy but consider the requirements required with upgrades and like clxd require installing the app and all dependencies just like on a virtual machine and both lexi and lexd and docker are containers and they both provide much leaner virtualization than virtual machines anyway uh thanks for listening today and please subscribe and like if you like what you see and we will see you next time [Music] so [Music] [Music] [Applause] [Music] you
Info
Channel: Scotti-BYTE Enterprise Consulting Services
Views: 1,672
Rating: undefined out of 5
Keywords:
Id: Q5J9N67z_SM
Channel Id: undefined
Length: 14min 24sec (864 seconds)
Published: Sat Oct 16 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.