1 00:00:01,180 --> 00:00:05,620 In the last section we spoke about how we could open up a shell inside of a running container by using 2 00:00:05,620 --> 00:00:13,300 Docker exact dash I.T. and then passing in shell or just simply SDH as the command that we want to execute. 3 00:00:13,360 --> 00:00:17,980 We've been talking about all this in the context of the exact command which we can use to execute an 4 00:00:17,980 --> 00:00:20,620 additional command inside of a container. 5 00:00:20,740 --> 00:00:26,590 But if we wanted to we could also run Docker run the original Docker run command right here along with 6 00:00:26,590 --> 00:00:32,440 that I.T. flag and start up a shell immediately when a container first starts up. 7 00:00:32,440 --> 00:00:37,150 Now of course if we start up a shell right when the container first starts that's going to displace 8 00:00:37,180 --> 00:00:43,510 or keep any other typical or default command from running but sometimes it is quite useful to get a 9 00:00:43,510 --> 00:00:48,730 empty container with a shell inside of it and just be able to poke around and not have any other process 10 00:00:48,730 --> 00:00:49,400 running. 11 00:00:49,480 --> 00:00:52,140 So let's try that out right now at our command line. 12 00:00:52,230 --> 00:00:54,130 I'm going to flip back over to my terminal. 13 00:00:54,190 --> 00:00:55,890 I'm going to run it Docker run. 14 00:00:56,050 --> 00:01:00,790 I'm going to put on the I.T. so that we can attach to standard in on the process that we're about to 15 00:01:00,790 --> 00:01:02,300 start up. 16 00:01:02,500 --> 00:01:07,840 I will run the busy box image and then the appropriate program or the primary command that we're going 17 00:01:07,840 --> 00:01:11,100 to execute inside the container will be sdh. 18 00:01:11,170 --> 00:01:17,410 So this means start up a new container out of the busy box image run the SDH program which is a shell 19 00:01:18,400 --> 00:01:21,510 and attach to standard in of that program. 20 00:01:21,520 --> 00:01:27,400 So when I run this I'll be presented with a command prompt and just like we saw a moment ago I can run 21 00:01:27,400 --> 00:01:33,250 the Ellis command I can ping Google dot com and hit control C to stop it. 22 00:01:33,250 --> 00:01:36,620 I can echo a message whatever I want to do. 23 00:01:36,640 --> 00:01:39,580 Again this is a command that you might be using somewhat frequently. 24 00:01:39,580 --> 00:01:42,150 Anytime that you want to poke around a container. 25 00:01:42,160 --> 00:01:47,800 The downside to using Docker run with I.T. and SDH is that chances are you're not going to be running 26 00:01:47,830 --> 00:01:49,370 any other process. 27 00:01:49,390 --> 00:01:54,520 It's a little bit more common that you're going to want to start up your container with a primary process 28 00:01:54,580 --> 00:01:59,950 of like maybe your web server or whatever it might be and then attached to it a running shell. 29 00:01:59,950 --> 00:02:04,780 By using the docker exact command wherever it is right here. 30 00:02:05,060 --> 00:02:08,740 But I just wanted you to be aware of this alternate use of Docker run. 31 00:02:08,740 --> 00:02:09,010 All right. 32 00:02:09,010 --> 00:02:11,110 Now one last thing I want to cover in the next section. 33 00:02:11,140 --> 00:02:13,270 So quick break and I'll see you in just a minute.