1 00:00:00,720 --> 00:00:06,210 At this point we have the ability to create a new custom image out of our Docker file and we can do 2 00:00:06,210 --> 00:00:12,480 so by running docker build dot the output from all that is this very last line right here that says 3 00:00:12,480 --> 00:00:14,910 successfully built blah blah blah. 4 00:00:14,910 --> 00:00:19,980 This is the idea of the image that was just created so we can now create a container out of this image 5 00:00:20,160 --> 00:00:25,800 by copying the idea and running Docker run and then placing the ideas in there. 6 00:00:25,800 --> 00:00:31,890 Now when we run this command an instance of our image we created we'll get a new container and inside 7 00:00:31,890 --> 00:00:35,550 that we're going to be running an instance of a server. 8 00:00:35,750 --> 00:00:40,050 So I'll hit enter and there we go we've got our copy of readies and again all the warnings. 9 00:00:40,050 --> 00:00:42,630 You can totally ignore now. 10 00:00:42,650 --> 00:00:47,110 One thing I want to point out here is that having to execute Docker run and then paste in that I.D. 11 00:00:47,380 --> 00:00:50,070 I don't have anymore about having a pasting that I.D. is kind of a pain. 12 00:00:50,180 --> 00:00:54,620 And it sure was a lot nicer earlier in the course when we were able to do stuff like just simply Docker 13 00:00:54,620 --> 00:00:56,920 run red S or Docker run. 14 00:00:56,930 --> 00:00:58,180 Hello world. 15 00:00:58,220 --> 00:01:03,890 In those cases we didn't have to memorize an I.D. to use so we can actually do the same by slightly 16 00:01:03,890 --> 00:01:06,620 changing the form of the docker build command. 17 00:01:07,130 --> 00:01:08,020 Here's what we're gonna do. 18 00:01:09,270 --> 00:01:14,520 We are going to run docker build and we're going to add on this little argument right here that is going 19 00:01:14,520 --> 00:01:20,730 to tag the image that is created and make it a lot easier to refer to it by a name that you and I can 20 00:01:20,730 --> 00:01:29,700 customize the convention for this is your Docker I.D. a slash the name of the project that you're working 21 00:01:29,700 --> 00:01:34,980 on a colon and then the version which traditionally is going to be latest whenever you are building 22 00:01:34,980 --> 00:01:36,650 the newest version of an image. 23 00:01:36,960 --> 00:01:39,650 But in general that is supposed to actually be a version. 24 00:01:39,720 --> 00:01:45,130 So traditionally a number or for the latest version of your image you simply say latest. 25 00:01:45,240 --> 00:01:46,880 Now this is a convention right here. 26 00:01:46,890 --> 00:01:52,200 You're going to see all projects in Docker trying to follow this convention as much as possible. 27 00:01:52,440 --> 00:01:57,420 And you might be wondering why some other images that we've been able to use have more simplified names 28 00:01:57,420 --> 00:02:03,170 like simply reticence or hello dash world or busy box. 29 00:02:03,170 --> 00:02:05,540 Well all those are community images. 30 00:02:05,550 --> 00:02:10,860 They're images that have been created by people in the community and kind of open source for very popular 31 00:02:10,920 --> 00:02:15,050 use anytime that you are creating an image of your own. 32 00:02:15,060 --> 00:02:18,740 You're always going to prefix it with your darker ideas. 33 00:02:18,750 --> 00:02:18,980 All right. 34 00:02:18,990 --> 00:02:21,490 So let's give this a shot and see how it works. 35 00:02:21,570 --> 00:02:30,210 So I'm going to flip back in my terminal and we are going to execute docker build dash t your Docker 36 00:02:30,210 --> 00:02:30,600 idea. 37 00:02:30,780 --> 00:02:36,980 So for me it's Steven Greider for you it's probably gonna be something else slash whatever you want 38 00:02:36,980 --> 00:02:38,160 the name of the project to be. 39 00:02:38,270 --> 00:02:41,640 So I'm going to use red as you can do red as you can do read a server. 40 00:02:41,750 --> 00:02:43,770 Really anything goes here. 41 00:02:44,060 --> 00:02:50,270 A colon and I'll say it specifically latest and then don't forget after all that stuff we still have 42 00:02:50,270 --> 00:02:56,960 to put in that dot at the very end still need to specify that built context which again is the source 43 00:02:56,990 --> 00:03:01,220 of all the files and folders that are going to going to be used to build your container out. 44 00:03:01,220 --> 00:03:06,020 One quick reminder we're not really doing a lot with this build context yet but we will use it for something 45 00:03:06,080 --> 00:03:08,210 later on in the course. 46 00:03:08,210 --> 00:03:08,480 All right. 47 00:03:08,540 --> 00:03:13,490 So once you got to all that in there we'll run that and then the output down here says successfully 48 00:03:13,490 --> 00:03:17,780 built the image I.D. but then it tagged it as this name. 49 00:03:17,780 --> 00:03:23,630 And so now we can start up a container out of this image by running Docker run and then using the name 50 00:03:23,630 --> 00:03:30,720 that we just provided of Steven Greider or whatever your tag is slash red it's and then you do not have 51 00:03:30,720 --> 00:03:32,930 to actually specify the version on the end. 52 00:03:33,110 --> 00:03:35,340 You can simply leave it as your doc right. 53 00:03:35,340 --> 00:03:40,250 You slash redness if you don't put on the version on the end then the latest version of the container 54 00:03:40,250 --> 00:03:45,110 or mutilated version of the image will be used by default so I'll run that. 55 00:03:45,110 --> 00:03:48,920 And sure enough we get our Docker image running. 56 00:03:49,000 --> 00:03:49,390 All right. 57 00:03:49,750 --> 00:03:55,430 So one last quick kind of nitpick thing I want to throw out here just because you might see some documentation 58 00:03:55,430 --> 00:03:56,590 it looks a little bit confusing. 59 00:03:56,860 --> 00:04:01,770 Technically the version number on the very end here this is technically the tag. 60 00:04:01,930 --> 00:04:07,480 Now the entire process of what we just did is known as tagging the image and even the argument we used 61 00:04:07,480 --> 00:04:08,800 was dash to you right here. 62 00:04:08,800 --> 00:04:14,890 So we call this process tag in the image but technically just the version on the end is the tag everything 63 00:04:14,890 --> 00:04:18,430 else on here is actually like the repository or the project name. 64 00:04:18,430 --> 00:04:22,390 So just a little bit of a nitpick I just want you to be aware of that. 65 00:04:22,450 --> 00:04:22,710 All right. 66 00:04:22,720 --> 00:04:23,620 So that's pretty much it. 67 00:04:23,650 --> 00:04:26,080 Let's take a quick break and we'll continue in the next section.