1 00:00:00,790 --> 00:00:05,300 We were just talking about the differences between starting and creating a container. 2 00:00:05,620 --> 00:00:12,100 Along the way we ran the command Docker create and then something like Busy Box echo Hi there. 3 00:00:12,100 --> 00:00:16,990 We then got this print out of the container I.D. that was created and then we found that we could start 4 00:00:17,050 --> 00:00:21,090 up the container by running Docker start and then pasting the ideas in. 5 00:00:21,610 --> 00:00:24,190 However there is a real little catch to that. 6 00:00:24,220 --> 00:00:29,380 We found that in order to actually see information being printed out from the container we had to add 7 00:00:29,380 --> 00:00:31,670 in that dash a flag right there. 8 00:00:31,690 --> 00:00:36,520 So what would happen if you wanted to get all the output from the container without having to add in 9 00:00:36,520 --> 00:00:42,460 that dash a flag for example let's imagine that running Docker start like this was a really expensive 10 00:00:42,460 --> 00:00:47,820 process and we started up a process inside there that would take many minutes to run. 11 00:00:47,830 --> 00:00:52,780 Chances are if we forgot to add on the dash a flag to see the output from that we might be a little 12 00:00:52,780 --> 00:00:58,210 bit frustrated with ourselves because then we would have to rerun Docker start dash Shea a second time 13 00:00:58,390 --> 00:01:04,900 and wait another couple minutes in order to get around that we can make use of an additional command 14 00:01:05,320 --> 00:01:11,860 of Docker logs and then the idea of the container that we want to get output from the logs command could 15 00:01:11,850 --> 00:01:16,850 be used to look at a container and retrieve all the information that has been emitted from it. 16 00:01:16,990 --> 00:01:23,620 Let's try using that Docker create start and then logs command again and see what happens. 17 00:01:23,620 --> 00:01:30,790 So I will do Docker create busy box and I will echo Hi there. 18 00:01:30,930 --> 00:01:39,930 I'll then take that idea and run a docker start and paste the idea that starts up the container it executes 19 00:01:40,020 --> 00:01:43,540 echo high there inside of it and then it immediately exits. 20 00:01:43,560 --> 00:01:48,300 And so now at this point I want to go back to that stopped container and get all the logs that have 21 00:01:48,300 --> 00:01:50,160 been emitted inside of it. 22 00:01:50,160 --> 00:01:57,410 So to do so I can run at Docker logs and then paste that idea in and I'll see that when the container 23 00:01:57,410 --> 00:01:59,770 had been running it had printed out the string. 24 00:01:59,780 --> 00:02:01,730 Hi there. 25 00:02:01,730 --> 00:02:06,950 One thing to be really clear about is that by running Docker logs I'm not rerunning or restarting the 26 00:02:06,950 --> 00:02:09,620 container to end in any way shape or form. 27 00:02:09,830 --> 00:02:16,460 I'm just getting a record of all the logs that have been emitted from that container the docker logs 28 00:02:16,460 --> 00:02:21,350 command is something that we're going to be using quite a bit as we are trying to debug or set up new 29 00:02:21,350 --> 00:02:26,150 containers because as you can see it's a really good way to kind of inspect a container and see what's 30 00:02:26,150 --> 00:02:28,070 going on inside of it. 31 00:02:28,070 --> 00:02:28,420 All right. 32 00:02:28,460 --> 00:02:30,020 Still a couple of more commands to get through. 33 00:02:30,050 --> 00:02:33,110 So let's take another quick pause right here and continue in the next section.