you need to learn Docker RIGHT NOW!! // Docker Containers 101

2.78M views4506 WordsCopy TextShare
NetworkChuck
Create a Docker Container on Linode right now w/ $100 credit: https://bit.ly/nc_linode *Sponsored b...
Video Transcript:
hey do you want to see me build a docker container yeah let's do it real quick [Music] done want to see it again done man that was fast [Music] containers if you're in it you got to know it if you want to learn cloud azure aws google linode devops networking systems i think i said everything right so i hope you have your coffee ready in this video we're covering three things first what the junk is docker two you're getting hands-on with docker i'm giving you access to a free lab thanks to the sponsor of this video lenode and then three we'll go a bit deeper talk about the big why why docker alright let's do it okay what the junk is a docker container whoa whoa whoa we're getting ahead of ourselves here before we can define what a docker container is we have to first define what it's replacing virtual machines what is a virtual machine how many of you already know check the time stamps to jump forward but we're going to cover what it is real quick and i actually have a ton of virtual machines running on servers in my data center right now and i've been meaning to get those servers out of there because i'm paying a high bill i want to bring those home with me right now let's go get it [Music] whose things should i unplug goodbye davidson [Music] [Applause] so here's one of my babies ugh my servers now before we answer the question what in the world is a docker container we have to first talk about what's a virtual machine let's dig in so this is my server traditionally before virtual machines you would install one operating system on this piece of hardware oh bit dusty all of the server's resources from the cpu to the ram to the hard drive all of it was dedicated to one operating system one server os so like i might just have linux and this is my linux server or i might just have windows this will be my windows server 2016. now what's the issue with that well none really unless you want another server another operating system so before virtual machines if you wanted a windows server and a linux server you had to have two physical servers like this so that's where virtualization comes in instead of installing one operating system we're going to install something called a hypervisor [Applause] now a hypervisor is kind of like an operating system but it only has one goal its goal is to help you carve up or divide your server's resources into multiple servers now there are a ton of hypervisors but the most popular one would be vmware which is what i have installed on my servers and specifically it's called esxi bonus points if you tell me in the comments what this means or what it stands for and simply what it allows us to do is take a portion of our server's resources maybe two gigs of ram two cpus 100 gigabytes of hardware drive space and this will be our ubuntu server and then on the same server i could say over here i could have one cpu not cup one cpu two gigs of ram 40 gigs of hard drive space and that will be my windows server 2016 and i can keep doing this until my server runs out of resources or i can even make these bigger going from i don't know one cpu to 41 i mean you can go crazy virtual machines are amazing and people use them every single day but that's not how docker works in fact docker's kind of well not just kind of it's different when we use docker containers it takes us back to before virtualization we're going to install one operating system on this entire thing so one operating system gets access to everything our server has to offer but why do that that's the big question right what is docker doing here here's what it is and this is crazy i want to drop this line on you okay where virtualization and virtual machines are virtualizing hardware docker virtualizes the operating system what what does that even mean [Applause] [Music] now this right here is what we commonly see when we visualize how virtualization works we have our hardware we've got our our hypervisor and then we have our guest operating systems but let me show you what docker looks like we'll always have our hardware but instead of a hypervisor like we just discussed we're going to have one operating system installed on top of this hardware or onto the hardware and let's just say for our case we are going to install ubuntu now here we go we'll then have our good old buddy docker fly in and uh make some magic happen docker installs like any other application you might install on linux it'll be a process running or a daemon running and then using docker we will virtualize portions of our operating system in this case ubuntu to create containers which by the way we'll define here in a moment but they're really doing the same thing as these virtual machines over here they have the same function and they have a lot of the same qualities which is why it's kind of cool how they can replace virtual machines controversial but that's what i think and these containers much like vms can be running a different operating system centos and even ubuntu you can install ubuntu on ubuntu what okay but what are these things what are containers i like to think of them as crazy fast lightweight micro computers and don't let micro fool you like they're they can be as powerful as you want them to be and similar to a virtual machine they'll have their own operating system their own cpu processes their own memory their own network and the most important thing and i think it's really appropriate for nowadays is that they're quarantined they are isolated they are secure as far as they understand they are their own thing they might as well be installed on bare metal servers because that's how isolated they are wilson they're as isolated as you are right now what too soon let me say it again these suckers are lightweight and they are wicked fast like you saw at the beginning of this video click bam it's there now we'll cover why they're more lightweight why they're faster and and more of why they're amazing here in a moment but i think it's time i think it's time you got your hands dirty your feet wet all those things we're gonna do that right now time to get your hands on with docker containers i'm so excited about this you might say i can't contain myself sorry okay here we go fire up your web browser go to the link below lynnode. com forward slash network chuck and you get 20 of free credit more than enough to play with docker so go ahead and create that free account and we will start labbing right now now as i mentioned before lenode is a cloud service provider very similar to aws azure google and we're going to use them as our cloud service provider right now so from the dashboard we'll go to the top right and click on create and we'll create a lenode now right now you should be on distributions i want you to click on one click click on that and this is what's really cool about this look at all these pre-built apps you can just deploy in the cloud wordpress openvpn run your own vpn server in the cloud minecraft okay cool csgo i kinda wanna do this now anyways the one we wanna look at now is obviously docker bam a select docker now you can install and run docker anywhere windows linux you can install on a virtual machine but this is great because it makes it easy docker is already ready to go i'll just click create i'll select my size 10 bucks a month hey that's half of what you are getting for free right now i'll name it my friggin sweet doctor lab and then a root password for your root user and then click create ah forgot my region i'm in dallas that way i get super fast performance go now this is essentially creating a virtual machine for you in a lino cloud and it's pre-baked with docker and once yours is ready click on launch console at the very top here and right here in the browser you have access as soon as it's done doing your its updates but if you're like me i like to use your own terminal more of a homey feel so i'll grab the public ip address right here copy that and open up my own which is solar putty i highly recommend solar putty you should use it go download it now link below it's free and i'll connect your name root and the password is what i just set and i'm in i'll clear this out i've got my own ready to run docker empire yeah i'll call it that so for this lab we're going to do three things we're going to install centos we're going to install alpine and a third mystery thing which makes docker the coolest thing ever so hang tight but let's do let's do centos first first i need the image so i'll do docker pull centos what this is doing is it's going out to the docker hub which is a registry of docker images these images are what we use to run or create our containers i'll show you real quick so we'll go ahead and pull the image for centos it'll go out and find it and download it bam we've got it so now with that centos image we're going to run our first docker container so it'll be the command docker run we're gonna use a few switches dash d and dash t then we'll do dash dash name to name this container i'll name mine can't contain myself name yours whatever you want and then at the end i'll specify the image i want to use which is the one we just pulled down sent os and this is how fast docker containers are created and run it's running that was it a virtual machine booting a virtual machine takes a whole lot longer than that that's crazy so let's make sure it's running we'll use command docker ps to see our running docker containers there she is and she's so pretty look at her that is centos isolated secure running with its own operating system cpu memory network oh it's quarantined but let's um let's walk into the room real quick we can connect to centos and start playing around with it by using the command docker exec i'll use the switch dash i t and then i'll reference the name we named it so it was can't contain myself for me if i spell it right and then after the name i'll specify i want to connect to the bash shell boom and i'm in centos i am in a container and look i mean it even has its own file system like it's completely separate to get out of there we'll just do a quick type and exit and we're back home and you'll know where you are if you pay attention to root at blah blah blah that's the container id we were just in centos over here is my docker machine here so i'm going to clear my screen let's do another one we'll do docker pull let's say we pull down alpine a very popular linux distribution because it's very uh very lightweight especially for docker see i mean it pulled it down so quickly and we'll do docker run dash t dash d i'll name this oh yeah and then the image name was alpine boom another one started if i do docker ps two containers running awesome let's connect to it docker exec dash it oh yeah and then alpine i'll just connect to the shell so i'll type in sh and boom i'm there i'm an alpine a separate operating system a separate container quarantined it's so cool you know what you can do this too if you want i'm gonna install a whole bunch of things right now okay so now if i do docker ps i got a few things going on i've got three different flavors of ubuntu running right now 16 14 and 18 on the same server that's amazing wordpress it's it's it's cool now for number three and i want you to do this with me this is actually a um a docker image that i created a while back for my azure course on cbt nuggets if you want to check the course out link below but using this image i want to demonstrate the power the amazingness is that a word yes it is now of docker let's do it real quick so first i want you to pull down my image now to find it let's go to docker hub it's hub.
docker. com this is a registry where you can download and pull all these images from docker and they have a ton of stuff um some of the stuff they have is from me so if you type in network chuck in the search bar i come up here and actually have two out there i don't know if the other one's for but the one i want you to click on is coffee based training has 879 downloads that's pretty cool jump in there and even shows you like the command you can use to pull down this image now don't use that just yet i want you to copy the network chuck forward slash nc coffee and we're going to use the tag french press and i'll show you how to use a tag right now so the command will be docker pool i'll paste in my name here the network chucky chucky the network chuck forward slash nc coffee and then colon french press the tag basically gives us the ability to download different versions of a particular image i did that with ubuntu just earlier i could specify the tag 16 17 whatever and download different versions so i'm going to pull down my image boom it's ready now i'm going to run it clear things out here so i'll do docker run dash t dash d and then one more switch here dash p which sends reports and we're going to map port 80 which is a port for our website obviously we'll map that from our docker container to our host and for any exam people out there who are studying for the devnet associate or ccna the port right here at the end is for the docker container and the port right here is for the host so i'm essentially saying match port 80 to port 80. then i'll name my guy name it nc coffee and then i'll specify the image which is the network chuck forward slash nc coffee and then colon french press and um it'll be quick done i'll do docker ps it's running now here's what i want you to do if you go back to your linode dashboard here grab the ip address once more copy it and then just plug that into your browser go to it it's a docker container running my website i made obviously it's a professionally designed website click on the link it'll take you to cbt nuggets i mean it's it's top notch if you want to hire me for web development i'm available now let me ask you a question did you set up this website did you alter any settings install any programs did you put in this like did you do any of this no but if you pulled down that image and ran that container like i just demonstrated you have a website that looks just like this you see that container not only has its own os cpu processes memory but it also has all the settings i applied my website configuration all the prerequisites all the dependencies packaged together and a neat little package a container no need to mess with it it's perfect and you can move that sucker to any computer any linux based machine and it runs like a champ i can move this same docker container to aws to azure to your computer to my computer to wherever and it's going to run the same and that's the power of docker so everything from the os which is debian linux to the things i had to install to make it work nginx which is a web server software and then all the website files that i used which you can tell by the quality of the site took a lot of stuff and then anything else i might need all dependencies packaged into a nice neat container that can run anywhere and now we're at number three of our objective kind of talking about the big why why why docker containers why are they so killer compared to virtual machines and really why should you care about them we've seen a few of the things like they're lightweight and they're fast and we just saw what i think is one of the coolest things about it is that they're portable no matter where they run they run another example of why this is absolutely killer is like look here i've got different flavors of ubuntu i might have apps that aren't compatible to run on a certain version of ubuntu oh and by the way before we go any further if you want to stop any of these containers you can do that here just do stuff docker stop and then the container name so i'll drop like one of my uh i'll drop alpine oh yeah and then i can start him right back up again docker start oh yeah and bam he's up again and if you want to like see how much cpu they're using memory network we can do docker stats and we get this cool i mean i think it's cool view of all that's going on real time and then ctrl c to back out of there well this is for all of you who told me to try out arch linux i can install as a docker container as well and boom just like that i'm running arch linux okay at this point we've learned a bit about docker containers we've even created a few and played around with the command line that that was fun now we're gonna go just a little bit deeper not too deep because we we don't have the time but we'll talk about okay why is it so fast why is it so lightweight and how is the industry using it right now this will be real quick let's talk about it so first of all why is it so fast how does it boot up so fast how do we create containers so quickly what's the voodoo behind that the short answer is that you only need one kernel notice that over here when i'm demonstrating docker all of these os's are linux based they all share the underlying linux kernel just like ubuntu does so ubuntu when we installed him he's running off the linux kernel and it's the same linux kernel that all of these os's right here would use so this part of the os is already up and running and that's in stark contrast over here on a virtual machine you see each of these os's have their own linux kernel they're spinning up i'll just put lk for the rest because they are virtual machines and every time you deploy a new virtual machine that's another linux kernel and then the operating system and that steps into the other part is they're lightweight why are they lightweight because we don't need more than one linux kernel you see these virtual machines to run more than one os and to have this app isolation like we want to with containers we have to have a guest operating system every time which involves another kernel it involves a hypervisor which is also kind of heavy so it's overall just heavy there are more parts and pieces that have to be running to make that work whereas a container is much more simple lightweight and fast now one thing i want you to note and you probably notice this i have a windows server over here but i didn't install windows server over here on linux you can't do that containers are available docker you can install on windows based systems windows 10 windows server i believe 2016 and up but you can only install windows based containers on a windows system same goes for linux you can only install linux based containers on a linux system because they share the same underlying os or kernel and yeah docker on windows is cool you can install docker containers on windows and it shares the same qualities as a linux docker container they're isolated they have their own processes and memory and network it's just as cool now what i've given here was a very high level overview we didn't go very deep at all docker is a big thing like there's there's an entire docker certification it's it's huge and if you want to learn more go deeper because there's a lot more maybe you want to learn more about how containers work maybe you want to learn hey like they're using control groups which are defining how much cpu how much memory how much os resources that you're giving each docker container and then how they're segmenting it isolates isolating everything with namespaces and by the way these two concepts that can be attributed to containers have been around for a long time containers have been a thing for a very very long time docker isn't the only type of one either so it's a whole big thing so if you want to dive deeper if you want to create your own docker containers there's a great course from sean powers at cbt nuggets link below and uh if you want to learn more just about the the behind the scenes and under the hood uh i'll link some books and stuff below as well now the last thing i wanted to mention is how is the industry using docker well we already demonstrated that we could put a docker container up in the cloud linode we just did that you can move that same docker container to azure to aws they have the same sort of situation with docker it's just like a web app you deploy and you can launch your containers this is killer for developers because they can write their code deploy it in a docker container and know that it works everywhere and that's a problem with developers that they've had for a long time is that they'll write an app on their computer and it works great they spent time polishing it you know dotting their eyes and all kinds of stuff and that same code is run by i don't know a tester and it doesn't work and the developer's like well hey it worked on my machine i don't know what you're doing no more of that junk no more of that because if you deploy in a docker container everything that app needs is right there in its container it's contained it's isolated and finally the last thing that has kind of taken the industry by storm is the concept of micro services this is more for developers but as a person who's an i.
Related Videos
you need to learn Kubernetes RIGHT NOW!!
29:34
you need to learn Kubernetes RIGHT NOW!!
NetworkChuck
1,258,780 views
Docker Crash Course for Absolute Beginners [NEW]
1:07:39
Docker Crash Course for Absolute Beginners...
TechWorld with Nana
1,892,402 views
18 Weird and Wonderful ways I use Docker
26:18
18 Weird and Wonderful ways I use Docker
NetworkChuck
397,960 views
Docker networking is CRAZY!! (you NEED to learn it)
39:12
Docker networking is CRAZY!! (you NEED to ...
NetworkChuck
1,813,459 views
you need to learn Virtual Machines RIGHT NOW!! (Kali Linux VM, Ubuntu, Windows)
27:41
you need to learn Virtual Machines RIGHT N...
NetworkChuck
9,670,653 views
The intro to Docker I wish I had when I started
18:27
The intro to Docker I wish I had when I st...
typecraft
263,315 views
run Linux on Windows Docker containers!!
37:59
run Linux on Windows Docker containers!!
NetworkChuck
180,166 views
you need to learn Ansible RIGHT NOW!! (Linux Automation)
21:21
you need to learn Ansible RIGHT NOW!! (Lin...
NetworkChuck
891,695 views
Docker Tutorial for Beginners
50:38
Docker Tutorial for Beginners
mCoding
70,543 views
Virtual Machines Pt. 2 (Proxmox install w/ Kali Linux)
30:39
Virtual Machines Pt. 2 (Proxmox install w/...
NetworkChuck
1,289,188 views
Kubernetes Tutorial for Beginners [FULL COURSE in 4 Hours]
3:36:55
Kubernetes Tutorial for Beginners [FULL CO...
TechWorld with Nana
8,413,087 views
you need to learn Load Balancing RIGHT NOW!! (and put one in your home network!)
42:42
you need to learn Load Balancing RIGHT NOW...
NetworkChuck
1,146,327 views
NestJs Course for Beginners - Create a REST API
3:42:09
NestJs Course for Beginners - Create a RES...
freeCodeCamp.org
1,618,939 views
Linux on Windows......Windows on Linux
23:54
Linux on Windows......Windows on Linux
NetworkChuck
508,670 views
CompTIA Network+ Certification Video Course
3:46:51
CompTIA Network+ Certification Video Course
PowerCert Animated Videos
7,917,480 views
Kubernetes Course - Full Beginners Tutorial (Containerize Your Apps!)
2:58:01
Kubernetes Course - Full Beginners Tutoria...
freeCodeCamp.org
664,157 views
let's hack your home network // FREE CCNA // EP 9
30:16
let's hack your home network // FREE CCNA ...
NetworkChuck
4,013,746 views
Docker Tutorial for Beginners [FULL COURSE in 3 Hours]
2:46:15
Docker Tutorial for Beginners [FULL COURSE...
TechWorld with Nana
5,347,647 views
Complete Docker Course - From BEGINNER to PRO! (Learn Containers)
4:44:21
Complete Docker Course - From BEGINNER to ...
DevOps Directive
403,013 views
Kubernetes Crash Course for Absolute Beginners [NEW]
1:12:04
Kubernetes Crash Course for Absolute Begin...
TechWorld with Nana
2,916,399 views
Copyright © 2024. Made with ♥ in London by YTScribe.com