1 00:00:00,720 --> 00:00:05,730 In last section we found that we were able to connect to read a C lie inside of our running docker container 2 00:00:06,240 --> 00:00:09,260 and notice how mine is still running over here on the second window. 3 00:00:09,480 --> 00:00:12,070 By adding on the dash I t flag. 4 00:00:12,150 --> 00:00:13,610 So when I did that we saw. 5 00:00:13,620 --> 00:00:14,880 Yep we got this prompt here. 6 00:00:14,880 --> 00:00:16,280 We could enter stuff in. 7 00:00:16,380 --> 00:00:19,430 I could then first control C to exit back out. 8 00:00:19,830 --> 00:00:27,980 However if I tried running this command without the I.T. flag it appeared that I just got kicked directly 9 00:00:27,980 --> 00:00:29,550 back over to my terminal. 10 00:00:29,570 --> 00:00:34,310 So in this section I want to give you a better idea of what this dash I.T. flag right here is really 11 00:00:34,310 --> 00:00:35,610 doing for us. 12 00:00:35,630 --> 00:00:40,190 The first thing you need to understand is a little bit more about how processes run inside of a Linux 13 00:00:40,190 --> 00:00:41,090 environment. 14 00:00:41,180 --> 00:00:45,740 As a quick reminder when you are running Docker on your machine every single container that you are 15 00:00:45,740 --> 00:00:50,540 running is running inside of a virtual machine running Linux. 16 00:00:50,660 --> 00:00:54,400 So these processes are really being executed inside of a Linux world. 17 00:00:54,440 --> 00:00:56,400 Even if you're on Mac or Windows. 18 00:00:57,020 --> 00:01:03,630 All right so that mind in this diagram we've got three different running processes all inside in theory 19 00:01:03,630 --> 00:01:07,470 of a running container or really inside of a Linux environment. 20 00:01:07,470 --> 00:01:12,600 Every process that we create in a Linux environment has three communication channels attached to it 21 00:01:12,910 --> 00:01:18,810 that we refer to as standard in standard out and standard air these channels are used to communicate 22 00:01:18,810 --> 00:01:23,290 information either in to the process or out of the process. 23 00:01:23,430 --> 00:01:28,180 Standard in as you might guess is used to communicate information into the process. 24 00:01:28,230 --> 00:01:35,730 So when you are at your terminal and you type stuff in the stuff you type is being directed into a running 25 00:01:35,760 --> 00:01:42,090 standard and channel attached to say the red a apply the standard out channel that is attached to any 26 00:01:42,090 --> 00:01:46,530 given process is going to convey information that is coming from the process. 27 00:01:46,530 --> 00:01:51,750 So standard out might be redirected over to your running terminal and that's going to end up as being 28 00:01:51,750 --> 00:01:58,120 stuff that is going to show up on the screen standard error is very similar but it conveys information 29 00:01:58,210 --> 00:01:59,250 out of the process. 30 00:01:59,320 --> 00:02:01,600 That is kind of like an error in nature. 31 00:02:01,600 --> 00:02:06,610 So if red Seelye has some error inside of it that's can be communicated to the outside world over the 32 00:02:06,610 --> 00:02:09,930 standard error channel and very similar to standard out. 33 00:02:10,000 --> 00:02:15,040 That's going to be redirected to show up on the screen of your terminal. 34 00:02:15,040 --> 00:02:17,370 So how does that relate to the I.T. flag. 35 00:02:17,440 --> 00:02:24,790 When we do the docker Zac dash I.T. will the I.T. right here is actually two separate little flags. 36 00:02:24,820 --> 00:02:29,170 In reality it's a dash eye and a dash t like so. 37 00:02:29,170 --> 00:02:35,020 But by convention we usually just kind of shorten it down to be simply I.T. which is 100 percent equivalent 38 00:02:35,020 --> 00:02:42,160 to the two separate flags the Dash I on here means when we execute this new command inside the container 39 00:02:42,460 --> 00:02:49,120 we want to attach our terminal to the standard in channel of that new running process. 40 00:02:49,120 --> 00:02:55,270 So by adding on the dash IV flag we are saying make sure that any stuff that I type gets directed to 41 00:02:55,270 --> 00:03:03,380 standard in of red a CLIA the dash t flag is what kind of makes all this text show up a little bit pretty. 42 00:03:03,420 --> 00:03:07,620 Now in reality it's doing a little bit more than that but at the end of the day the real effect that 43 00:03:07,620 --> 00:03:13,170 the dashed you flag is to make sure that all the text that you are entering in and that is coming out 44 00:03:13,290 --> 00:03:15,960 shows up in a nicely formatted manner on your screen. 45 00:03:15,960 --> 00:03:19,470 And again it's doing a little bit more behind the scenes in that but at the end the day that's kind 46 00:03:19,470 --> 00:03:26,280 of its effect let's try attaching or doing our Docker Zach on the running container one more time and 47 00:03:26,280 --> 00:03:32,740 leaving off the dash t flag and just seeing what happens so I'll do a docker P.S. to get my containers 48 00:03:32,740 --> 00:03:40,480 idea again and I'll do a docker exec and then we'll do only Dash I this time I'll put the idea in and 49 00:03:40,480 --> 00:03:42,680 then I'll do red as CSI. 50 00:03:42,740 --> 00:03:46,020 And so now this time you'll notice how I have my cursor over here. 51 00:03:46,030 --> 00:03:51,010 It appears that this thing is waiting for input but I didn't do not see that kind of nicely formatted 52 00:03:51,040 --> 00:03:57,910 indentation I saw before and if I put in like set my value five before I had a little bit of auto complete 53 00:03:57,910 --> 00:04:01,860 functionality but this time that auto complete is definitely not there. 54 00:04:02,140 --> 00:04:08,260 I can still run that command though and I still see okay and I can still do get my value and I still 55 00:04:08,260 --> 00:04:09,030 see the value come out. 56 00:04:09,040 --> 00:04:14,350 But again all this all this stuff is not nicely formatted and so that's kind of the purpose. 57 00:04:14,350 --> 00:04:20,330 More or less kind of simplifying things here just a little bit of that dash t flag okay. 58 00:04:20,360 --> 00:04:20,990 That's pretty much it. 59 00:04:21,020 --> 00:04:26,570 That's the purpose of I.T. it allows us to have stuff that we type into our terminal directed into that 60 00:04:26,570 --> 00:04:31,130 running process and allows us to get information out back over to our terminal. 61 00:04:31,130 --> 00:04:34,640 So then mind let's take a quick break right here and continue in the next section.