1 00:00:00,870 --> 00:00:04,550 In this section we're going to take another look at a very commonly used command. 2 00:00:04,570 --> 00:00:07,130 It's the command that we're going to look at is Docker. 3 00:00:07,140 --> 00:00:13,140 P.S. This command will list all the different running containers that are currently on your machine. 4 00:00:13,170 --> 00:00:16,450 Let's try running it right now and just see what happens. 5 00:00:16,590 --> 00:00:19,350 I'll flip on over to my terminal and I'll run Docker. 6 00:00:19,360 --> 00:00:25,350 P.S. When I run this command you're going to see some headers for a table. 7 00:00:25,350 --> 00:00:27,820 At present we have no containers running our machine. 8 00:00:27,900 --> 00:00:31,740 So we have no entries inside this table at this point. 9 00:00:31,740 --> 00:00:37,470 We've only been running images or creating containers that run very quickly and then immediately closed 10 00:00:37,470 --> 00:00:38,160 down. 11 00:00:38,160 --> 00:00:44,050 So for example when we were running Docker run a Busy Box and echo Hi there. 12 00:00:44,190 --> 00:00:49,290 That container starts up and then almost immediately exits us back to the command line. 13 00:00:49,290 --> 00:00:54,270 So if we want doctored piece to be meaningful at all we have to have some container that is running 14 00:00:54,270 --> 00:00:59,970 for some longer amount of time in order to get a container running a little bit longer. 15 00:01:00,000 --> 00:01:04,590 We could substitute the command that is executed when that container starts up. 16 00:01:04,620 --> 00:01:11,890 So rather than running echo HI THERE I'LL TRY IT Docker run Busy Box and then I'll do ping Google dot 17 00:01:11,890 --> 00:01:13,130 com. 18 00:01:13,170 --> 00:01:18,500 This is a command that's going to attempt to ping Google's servers and measured the amount of latency. 19 00:01:18,630 --> 00:01:22,470 It's a command that's going to continue running for a quite a long time. 20 00:01:22,830 --> 00:01:24,270 So here it is running right here. 21 00:01:24,270 --> 00:01:28,770 And as you can see it takes about two or three milliseconds for me to ping Google and get a response 22 00:01:28,770 --> 00:01:29,630 back. 23 00:01:29,700 --> 00:01:35,310 This command is going to continue running so we can now run a darker P.S. In a second window and we 24 00:01:35,310 --> 00:01:38,980 should see this container up here in the listing. 25 00:01:38,990 --> 00:01:43,800 I'm going to open up a second terminal window and then I'll execute Docker. 26 00:01:43,830 --> 00:01:44,880 Yes. 27 00:01:44,880 --> 00:01:47,620 And when I do so I'll then see that running container. 28 00:01:47,820 --> 00:01:49,590 I'm going to get this on one line really quickly. 29 00:01:49,590 --> 00:01:51,450 There we go. 30 00:01:51,450 --> 00:01:54,690 So this is a print up for the container that is currently running. 31 00:01:54,690 --> 00:01:58,990 That was issued the command of Ping Google dot com. 32 00:01:59,010 --> 00:02:04,200 We also see the containers I.D. which we can use for a lot of other operations it will look in to later 33 00:02:04,200 --> 00:02:07,220 on we'll see the image that was used for the container. 34 00:02:07,320 --> 00:02:09,870 We can see how long ago it was created. 35 00:02:09,870 --> 00:02:13,570 We get a status currently it's been up for 24 seconds. 36 00:02:13,770 --> 00:02:17,240 We'll see a listing of any ports that have been opened for outside access. 37 00:02:17,250 --> 00:02:21,260 And we're going to talk a lot about ports later on inside this course and at the very end. 38 00:02:21,270 --> 00:02:26,970 We'll also see a randomly generated name to identify this container in my case the randomly generated 39 00:02:26,970 --> 00:02:27,900 name was epic. 40 00:02:27,900 --> 00:02:35,200 Corey if I now flip back over to that running ping process I can press control see on my keyboard to 41 00:02:35,200 --> 00:02:42,080 stop it so press control see right now and I get kicked back to my command line as you might expect. 42 00:02:42,130 --> 00:02:47,760 If I then run Docker P.S. the second time I would not see that container anymore. 43 00:02:47,890 --> 00:02:54,790 So Dr. P.S. specifically shows running containers we can modify the docker P.S. command just a little 44 00:02:54,790 --> 00:03:02,520 bit to show all containers that have ever been created on our machine to do so we can execute Docker. 45 00:03:02,530 --> 00:03:06,710 P.S. dash dash all just two dashes. 46 00:03:06,710 --> 00:03:12,200 There we go when we execute that command we'll see a listing of all the containers that we have ever 47 00:03:12,200 --> 00:03:12,810 created. 48 00:03:13,280 --> 00:03:14,590 That's going to zoom out again. 49 00:03:14,690 --> 00:03:17,360 Again here really quickly just so I can see this table. 50 00:03:17,360 --> 00:03:19,380 There we go. 51 00:03:19,400 --> 00:03:23,840 So for every one of these containers these have all been containers that we have started up and then 52 00:03:23,840 --> 00:03:28,360 have either been shut down on our behalf or shut down naturally. 53 00:03:28,370 --> 00:03:34,480 So for each one of them we'll see the container I.D. image command when it was created its current status. 54 00:03:34,490 --> 00:03:39,320 In this case they're all exited any ports that have been opened up again we'll talk about those later 55 00:03:39,380 --> 00:03:43,770 and the randomly generated name for each one so in practice. 56 00:03:43,800 --> 00:03:48,330 We're going to end up using the docker P.S. command quite a bit to see what containers are currently 57 00:03:48,330 --> 00:03:49,860 running on our machine. 58 00:03:49,860 --> 00:03:55,050 One of the most common uses of Docker P.S. is not only to see what's running but also to get the idea 59 00:03:55,050 --> 00:04:00,480 of a running container because like I said we very frequently want to issue commands on a very specific 60 00:04:00,480 --> 00:04:01,080 container. 61 00:04:01,170 --> 00:04:03,690 And for that we need its I.D.. 62 00:04:03,690 --> 00:04:03,920 All right. 63 00:04:03,950 --> 00:04:05,520 So that's a talker yes command. 64 00:04:05,520 --> 00:04:08,520 Let's take a quick pause right here and continue in the next section.