Check out a free preview of the full Complete Intro to Containers (feat. Docker) course
The "Getting Set Up with Docker" Lesson is part of the full, Complete Intro to Containers (feat. Docker) course featured in this preview video. Here's what you'd learn in this lesson:
Brian explains that Docker is a command line tool that makes building and managing containers easier, and that has environments built in various languages. Docker allows engineers to build a container in less time and fewer lines of code because it manages chroot, namespaces, and cgroups for the engineer.
Transcript from the "Getting Set Up with Docker" Lesson
[00:00:00]
>> So you should have Docker Desktop installed at this point for MAC and Windows. There is no Docker Desktop for Linux, in which case you'll need Docker engine which doesn't have a GUI. You can see here this little Docker whale will be at the bottom in the system tray if you're in Windows.
[00:00:17]
You can see here I have Docker Desktop running. The next thing I wanna get you more acquainted with is Docker Hub. So you can just go to hub.docker.com. This is probably one of the best parts about Docker, is that they basically made these node terms and then npm for containers, right?
[00:00:38]
So I can just say hey, Docker, give me a MongoDB container and you just pull it down. It starts running it and it knows everything it's supposed to do. It's a bit of a black box, right? I don't know exactly what it's doing underneath the hood, I just know that it runs Mongo.
[00:00:51]
And that's great! Cuz I didn't wanna know how to run Mongo, if you know how to run Mango, you wish you didn't know how to run Mongo, right, one of those things. And it has, I'm gonna say thousands and tenths of thousands of containers, right? So you can see here it has official ones from Oracle, has an official MySQL one, Couch Base, DB2?
[00:01:14]
Does anyone use DB2? My dad was a DB2 salesman, that's true story. That's why I grew up around computers. I don't know why I thought that was necessary to share but it's sharing time. [LAUGH] Yeah, you can see here there's literally anything. So if I type Mongo, you'll see that the official Mongo one comes up right here and you can see this has been downloaded 10 million times, so a few times.
[00:01:43]
So feel free to sign up for an account if you want to. It's free, there's no reason not to. I have one. And I have published one container which we will be using during the class today. But that's when if I go in here and say docker mongo:3 like this, that's where, I need to get out of this.
[00:02:02]
So you can be done with this environment now so we can safely exit out of it. Hence, just so you know if you do exit out of it you've thrown away the entire environment, right? Because containers, once you close them, disappear into the ether, they don't save anything.
[00:02:18]
So let's just see, if you type docker ps it'll show you all your containers that are running. If your Docker is not working, you'll see an error message, if you try to run docker ps, it'll fix that. And if I say docker pull mongo:3 it's gonna go get this off of Docker hub, right?
[00:02:39]
It'll look something like this. So you can see, again, I'm just reminding you, some of these containers are quite big. This one is 117 megabytes. So let that run in the background for a little bit, so yeah, again, there's Docker containers for just about anything, right? There's ones for node, there's ones for Ruby, there's one for Go.
[00:03:03]
There's just about anything you can imagine someone's probably built a Docker container for, right? It's like node when you're writing something if you need a module, chances are someone's written that module and you can just npm install it. In this case, we can use Docker Hub for this.
[00:03:19]
So before you start going and building your own bespoke artisanal containers, check out to see if Docker Hub has it first.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops