1 00:00:08,680 --> 00:00:13,480 ‫Alright, since this is the first lecture in this section, I'm going to cover real quick what this whole 2 00:00:13,480 --> 00:00:16,130 ‫section is about and that's containers. 3 00:00:16,240 --> 00:00:21,850 ‫Containers are the fundamental building block of the Docker toolkit and that's one of the first things 4 00:00:21,850 --> 00:00:22,780 ‫we're going to learn. 5 00:00:22,810 --> 00:00:27,760 ‫We're not going to build images or do any advanced stuff until once we've learned what containers are, 6 00:00:28,060 --> 00:00:35,180 ‫how to run them, a little bit of how they're different from a VM, and other basic functionality of a container. 7 00:00:35,440 --> 00:00:40,730 ‫So the first thing we want to do is make sure that we have the latest version of Docker and it's working. 8 00:00:40,780 --> 00:00:46,450 ‫Once we get through that and this lecture, other lectures will talk about how to start containers, how 9 00:00:46,450 --> 00:00:50,230 ‫to manage different aspects of a container: start it, 10 00:00:50,230 --> 00:00:51,650 ‫stop it, 11 00:00:51,670 --> 00:00:52,420 ‫delete it, 12 00:00:52,420 --> 00:00:53,020 ‫create it... 13 00:00:53,020 --> 00:00:54,120 ‫that sort of stuff. 14 00:00:54,190 --> 00:00:59,740 ‫And we're going to use Nginx for all that. Nginx is a really basic web server that is going 15 00:00:59,740 --> 00:01:06,070 ‫to be easy for us to use just to learn the Docker commands and how to do Docker container stuff. 16 00:01:06,070 --> 00:01:11,860 ‫After that, we're going to jump in some networking basics. You'll learn Docker networking and how the 17 00:01:11,860 --> 00:01:13,330 ‫containers talk to each other. 18 00:01:13,840 --> 00:01:18,310 ‫And for this whole section, the only real requirement is that you have the latest version of Docker 19 00:01:18,310 --> 00:01:20,740 ‫installed and that it's working properly. 20 00:01:20,740 --> 00:01:25,610 ‫So in this lecture we're going to make sure real quick that that's set up correctly. 21 00:01:25,700 --> 00:01:31,070 ‫In order for the Docker command line to work properly, you need to make sure you're in the proper 22 00:01:31,100 --> 00:01:33,640 ‫terminal for your operating system. 23 00:01:33,650 --> 00:01:39,770 ‫I'm going to be using Mac, so I can use either Terminal or iTerm2; the two popular choices on the Mac. 24 00:01:39,860 --> 00:01:44,720 ‫Then on Windows, if you're on Docker for Windows you'll use PowerShell. 25 00:01:44,720 --> 00:01:50,150 ‫If you're on the Docker ToolBox, you'll use the QuickStart Terminal that comes with Docker ToolBox. 26 00:01:50,390 --> 00:01:54,020 ‫And if you're on Linux you'll just use a Linux shell of your choosing. 27 00:01:54,020 --> 00:01:58,700 ‫These are all things that I talk about in the previous section for your set-up of your own operating 28 00:01:58,700 --> 00:01:59,390 ‫system. 29 00:01:59,390 --> 00:02:01,850 ‫So if you have more questions just look at those videos. 30 00:02:02,060 --> 00:02:03,220 ‫But let's get started. 31 00:02:03,230 --> 00:02:10,180 ‫The first command is docker version. This command simply returns the version of your client -- 32 00:02:10,190 --> 00:02:17,240 ‫that's the CLI that we just used -- and the server, also called the engine; and, the engine is running 33 00:02:17,410 --> 00:02:19,820 ‫in the background on your machine. 34 00:02:19,820 --> 00:02:23,530 ‫On Windows it's usually called a service on Mac and Linux, 35 00:02:23,600 --> 00:02:24,910 ‫ot's usually called a daemon. 36 00:02:25,100 --> 00:02:31,670 ‫And what is happening here is our docker command line is actually talking to the server on my machine and 37 00:02:31,670 --> 00:02:35,550 ‫then returning its values, as well as the client values themselves. 38 00:02:35,750 --> 00:02:39,390 ‫Ideally they should be the same but they don't have to be the same versions. 39 00:02:39,650 --> 00:02:46,920 ‫And you want them to be the latest version as possible. If you have an older version like 1.12 or 1.13, 40 00:02:47,000 --> 00:02:51,880 ‫you definitely want to make sure that you go to the previous section and get the proper versions installed 41 00:02:51,890 --> 00:02:56,160 ‫because we'll be using a lot of new features that are only in the latest versions. 42 00:02:56,390 --> 00:03:02,260 ‫The fact that I did get returned information from the server, validates that I can talk to the server 43 00:03:02,330 --> 00:03:03,800 ‫and that it's working properly. 44 00:03:03,800 --> 00:03:08,480 ‫If you do get an error there, that means maybe you need to do a sudo docker version. 45 00:03:08,480 --> 00:03:14,180 ‫If you're maybe on Linux, or possibly your Docker isn't actually running and you maybe need to go to the 46 00:03:14,180 --> 00:03:18,800 ‫previous section setup videos to make sure that Docker's running properly. 47 00:03:18,800 --> 00:03:21,890 ‫Now let's get a little more information out of our Docker engine. 48 00:03:21,890 --> 00:03:29,930 ‫If we do a docker info, it'll return a lot more stuff than just the version. It'll actually give us a 49 00:03:29,930 --> 00:03:34,280 ‫lot of details about our configuration and setup for our engine. 50 00:03:34,280 --> 00:03:39,410 ‫Some of these are obvious, like the number of containers you have running or possibly the number of images 51 00:03:39,410 --> 00:03:41,330 ‫you have stored in Docker. 52 00:03:41,480 --> 00:03:44,920 ‫But a lot of this other stuff may not make sense now and that's fine. 53 00:03:44,930 --> 00:03:48,080 ‫We're going to go through a lot of it throughout this course. 54 00:03:48,080 --> 00:03:51,660 ‫Now you might be wondering what are all the commands you can use in Docker. 55 00:03:51,830 --> 00:03:57,430 ‫And you can get a list of those by simply just typing docker and hitting return. 56 00:03:57,490 --> 00:04:00,230 ‫You'll see a long list down here at the bottom. 57 00:04:00,490 --> 00:04:05,760 ‫This is not actually the full list, because if you notice up here at the top, 58 00:04:05,950 --> 00:04:08,310 ‫we now have this management command. 59 00:04:08,380 --> 00:04:16,030 ‫So starting in early 2017, Docker realized that we're getting so many commands down here in this list -- 60 00:04:16,620 --> 00:04:22,360 ‫where I would just type docker space and the command -- that there were so many of them that they needed 61 00:04:22,360 --> 00:04:26,850 ‫to create an easier way to organize all these commands. 62 00:04:26,980 --> 00:04:33,510 ‫That's when they created the management commands and that creates a format where you have docker 63 00:04:33,540 --> 00:04:41,090 ‫space the management command and then the subcommand. So you will see throughout this course that we're 64 00:04:41,090 --> 00:04:43,460 ‫trying to use a little bit of both. 65 00:04:43,520 --> 00:04:46,900 ‫We mostly will use the new model of Docker. 66 00:04:47,300 --> 00:04:53,730 ‫Let's use an example here of container run -- and that's the new format of that command. 67 00:04:53,840 --> 00:04:58,910 ‫But since the beginning of the Docker project, docker run has usually been the way that we type that 68 00:04:58,910 --> 00:04:59,650 ‫command. 69 00:04:59,660 --> 00:05:04,820 ‫It's just recently that the docker container run has become the new way to run that command. 70 00:05:04,820 --> 00:05:08,960 ‫Now the cool thing about Docker, is that it's really focused on backwards compatibility. 71 00:05:08,960 --> 00:05:15,410 ‫So the docker run will probably work forever; but, new commands that we get are not going to be using 72 00:05:15,440 --> 00:05:17,960 ‫this docker command value. 73 00:05:17,960 --> 00:05:25,460 ‫It will be using docker space command space subcommand value. So, each time I use these commands, 74 00:05:25,460 --> 00:05:29,810 ‫we will explain what they are and I will show you possibly the old way of doing it and the new way of 75 00:05:29,810 --> 00:05:32,690 ‫doing it depending on whether the command has that option. 76 00:05:32,750 --> 00:05:35,190 ‫So it'll start to make sense as we go through this course. 77 00:05:37,280 --> 00:05:42,140 ‫OK even though we had a very short lecture, and it was pretty simple, let's just review real quick those 78 00:05:42,140 --> 00:05:42,980 ‫commands. 79 00:05:42,980 --> 00:05:48,380 ‫The docker version command is the one I always use first on a new Docker system; just to make sure that 80 00:05:48,380 --> 00:05:52,780 ‫my client can talk to the engine and that I'm running the version that I would expect. 81 00:05:52,820 --> 00:05:59,360 ‫Secondly docker info gives me a lot of the configuration values out of the engine just to make sure that 82 00:05:59,360 --> 00:06:01,840 ‫it's set up that way that I expect. 83 00:06:01,890 --> 00:06:06,840 ‫And lastly, we talked about the command line structure. The old way still works. 84 00:06:06,870 --> 00:06:12,540 ‫So for older commands that have been around for the last 4+ years, they still work with docker 85 00:06:12,570 --> 00:06:14,400 ‫command and then the options. 86 00:06:14,400 --> 00:06:21,030 ‫But for new commands going forward, Docker is creating a new model of the management commands with docker 87 00:06:21,240 --> 00:06:25,550 ‫space command space subcommand. The example we use was docker run, 88 00:06:25,560 --> 00:06:31,350 ‫one of the most common commands you use in Docker where the old way was docker run but the new way of 89 00:06:31,350 --> 00:06:33,370 ‫docker container run also works. 90 00:06:33,540 --> 00:06:37,860 ‫And you can decide how you want to use those commands whether you want to use the old way or the new 91 00:06:37,860 --> 00:06:39,580 ‫way because they both will still work.