Docker Tutorials
Eduonix Learning Solutions · 30 lecciones · Gratis en YouTube
Docker for Beginners - Building Your Own Image
Sobre este curso
all right I'm really excited about this series demystifying docker I'm doing it because I've had so many conversations with other developers people I meet at
conferences where the people will say I'm really excited about docker because everybody keeps saying docker is awesome but I can't seem to wrap my head around it and I can't seem to find any
resources online that help me actually get started with docker and understand you know what it's actually good for so we're going to kind of cover that we're going to start off with a high-level
overview what is docker then we're going to show you with really quick just a few lines of code how you can deploy applications and then some kind of various thoughts on it along the way so
let's get into it demystifying docker first thing we're going to do is we're going to compare docker to vagrant or docker to a virtual machine since this seems to be the
hang-up that I keep hearing from people okay so I get vagrant but I don't get docker well that's because they're really different here's kind of three visual people a visual demonstration
what vagrant is I'm going to kind of show you real quickly vagrant for those you guys who aren't familiar with it and I'm going to show you how it's not really a fair comparison
so vagrant is the goal is to solve the problem of it works on my machine it doesn't work on production or it works on my machine it doesn't work on this other developers machine that happens
because somewhere along the road you might be on a different operating system say your machine is a Mac or Windows machine and you're pushing it out to a Linux you know server that alone could
cause problems you might be running WAMP or MAMP on your computer if it's a PHP application and these guys are actually running a full you know just native installation of an Apache stack or you
have a different toolset that you're using then another developer at any rate your environments are not the same so we solve that by spinning up a virtual machine in our computer that's the exact
same thing we're going to be pushing to staging or production so we'll use VirtualBox and vagrant to spin up let's say in a bun to 1404 machine which is exactly what we're using in staging and
production so here that that is it's an empty machine and then you run your provisioning script against your virtual machine exactly as you would against staging or production so the
provisioning it will install the correct version of nodejs or rails or PHP it'll set up all the user permissions it'll it'll install any other software configure anything
that needs to be configured so at the end of the day these are basically the same environment so now I know that if I dump my project code into here and run it in this machine and it works it's
pretty much going to work when I push it out to github and these servers pull it or I push it however you do your deployments when the code gets dumped into these it's going to run the same
so that's vagrant in a nutshell different boxes we dump our code into each box let's look at docker and see why docker is actually different so for docker we've got our machine and
we've got our project's code and docker runs off of containers so I use my docker file which is usually five to maybe thirty line fired file docker files are really small the docker file
builds what's called a docker image that docker image contains all my project code it contains you know say an installation of nodejs if it's a node.js app it contains any installments of
programs that I need and so it's basically my complete application wrapped up in an image now it's not a full say a bun to machine because I don't need that this image is designed
to sit on top of a machine so from that image I can then run as many containers as I want until I run out of processing power and RAM on my machine so this is the virtual machine on my Mac again and
I have my docker image on the machine and then I can run that docker image and it runs as a container and I can run many many containers in the machine once again till I run out of stuff so this
image is my project go so instead of on vagrant where I put my project code into environments with docker you're going to actually build your environment and now I can run that environment anywhere if a
machine has docker on it my container is going to run and it's going to work so then you push that docker image up to say docker hub or quad io which are kind of like the github
of docker images and there's a bunch out there you can have your own private repository the image goes out there that's like your github repository so to speak and now any other machine can run
your image so let's say I called this image my username is will our stern let's say I did will our stern / – that's the name of it so now on any computer I can say docker run will our
stern / – and this whole image source code and all will run with the complete environment I didn't install nodejs on this machine I didn't provision this
machine at all because the image has everything and has a complete environment all contained into one so I could run a nodejs image on this machine this container then has no js' installed
and has anything else installed npm and i can also run a rails app on the same machine rails is installed on that container but rails is not installed in this container so they act like virtual
machines but the really self-contained processes so to speak let me kind of show you an image here that i found somewhere online i have no idea what this puppy dog is about but this is
basically the anatomy of a docker container so this is your actual webserver you've got your webserver you have the host operating system which is a bun – or even something lighter and it
has docker installed that's all you need docker is installed and then all the apps run as docker containers and they all sit on top of your host operating systems resources so they all sit on top
of the Linux kernel they all access the same computer's processor and RAM and that's basically a docker container you build your image once push it out and now you can run it anywhere so kind of
in a large-scale production environment here's what that looks like I've got this big cloud cluster of say 10 computers they're all running either Kouros or mezzos these are kind of some
of the big players basically what these two operating systems do is they allow all the computers to act as one they share all their resources and so now all you have to do is spin up
containers and they all run within your cluster and then if you start running out of overall cluster memory or overall cluster computing you just add more nodes so let's say okay I'm just going
to add 10 more computers to this cluster and now I can run 30 more containers so you can just say let's once again let's say this image is called my node app I can run my node app 4 times boom boom
boom boom and then I can spin up an engine X container and have it load balanced these four and then expose a private port out to the real world so then the real world can access my app
this is how docker works it's it's really awesome for cloud computing really awesome for cluster computing and that's where it really really starts to shine but actually I think docker is one
of my favorite uses of docker is to just provision a single machine and deploy with no provisioning at all you just spin up a machine make sure docker is installed and then you can run your
containers on it so that's kind of your brief overview if you're not a visual person this is probably confusing but if you're a visual person it probably helped let's just get into docker show
me the code we'll do that in this next video
SIEMPRE HAY ALGO MÁS