1 00:00:00,634 --> 00:00:03,667 It is time to know our containers in greater depth. 2 00:00:04,001 --> 00:00:06,901 First we have the list of containers. Just to 3 00:00:06,901 --> 00:00:10,067 avoid any confusion, we have run an Ubuntu container 4 00:00:10,067 --> 00:00:11,967 after the context of last demo. 5 00:00:11,967 --> 00:00:15,801 Let's get more information about it with docker inspect command, 6 00:00:15,801 --> 00:00:18,501 followed by the container name, what we get as 7 00:00:18,501 --> 00:00:21,734 output is the JSON description of the container. 8 00:00:21,901 --> 00:00:24,201 We don't need to be intimidated by the sheer 9 00:00:24,201 --> 00:00:27,534 amount of information as we will interpret them one by one. 10 00:00:27,534 --> 00:00:29,734 Starting from the top, we have 11 00:00:29,734 --> 00:00:33,267 container id provided by Docker, timestamp of 12 00:00:33,267 --> 00:00:36,234 container creation, path where the container is 13 00:00:36,234 --> 00:00:40,334 running, no arguments since we haven't provided any. 14 00:00:40,334 --> 00:00:42,767 In the State bracket of the container, we have 15 00:00:42,767 --> 00:00:45,567 indications of the fact that our container is in 16 00:00:45,567 --> 00:00:49,567 running state and not paused or restarting or dead. 17 00:00:49,567 --> 00:00:52,767 Then it has not been killed by going out of 18 00:00:52,767 --> 00:00:57,534 memory, it's process id on Ubuntu is 694. 19 00:00:57,534 --> 00:01:00,967 Then we have information about the image in terms of image 20 00:01:00,967 --> 00:01:04,634 digest, and we have various paths such as host path, 21 00:01:04,634 --> 00:01:07,201 log path and configuration path. 22 00:01:07,201 --> 00:01:10,534 Then we have another bunch of information, where most of it 23 00:01:10,567 --> 00:01:12,867 is irrelevant to this particular container. 24 00:01:12,867 --> 00:01:16,401 So they are either null or empty, but which do matter 25 00:01:16,401 --> 00:01:18,934 are the name of the container and the fact that it 26 00:01:18,934 --> 00:01:22,101 has not restarted yet. Following this, we also 27 00:01:22,101 --> 00:01:25,067 have Network, Volume and other information, which 28 00:01:25,067 --> 00:01:28,701 might be useful to you once we proceed further in this course. 29 00:01:28,701 --> 00:01:31,067 For now, we can focus on finding 30 00:01:31,067 --> 00:01:33,467 specific information from the inspect command, 31 00:01:33,467 --> 00:01:36,534 since even if you get completely familiar with all 32 00:01:36,534 --> 00:01:40,034 the attributes, reading them every time can be really daunting. 33 00:01:40,034 --> 00:01:42,067 Let's use --format flag with our 34 00:01:42,067 --> 00:01:45,901 inspect command and narrow down the results to just IP address. 35 00:01:46,167 --> 00:01:48,301 We can do this by narrowing the 36 00:01:48,301 --> 00:01:51,134 range to networks and under Network Settings, 37 00:01:51,134 --> 00:01:53,101 choosing the IP address field. 38 00:01:53,534 --> 00:01:56,867 There we go, we have the IP address of our container. 39 00:01:57,134 --> 00:02:01,534 Next is the commit command. To effectively use that command we 40 00:02:01,534 --> 00:02:04,234 need to make at least one change to the container's 41 00:02:04,234 --> 00:02:06,801 state after it is created from the image. 42 00:02:06,801 --> 00:02:09,967 Just to remind you this ubuntu container is created from 43 00:02:09,967 --> 00:02:13,300 the same image that we had pushed on our Docker Hub repo. 44 00:02:13,467 --> 00:02:16,101 Let's execute it with bash, you should 45 00:02:16,101 --> 00:02:18,367 already be used to this command by now. 46 00:02:18,567 --> 00:02:21,434 Let's verify by listing out the directories. 47 00:02:21,634 --> 00:02:24,001 Yes, we are in the container. 48 00:02:24,001 --> 00:02:25,967 Now let's run an update. 49 00:02:25,967 --> 00:02:29,501 The purpose here is just change the state of container 50 00:02:29,501 --> 00:02:31,067 from when it was created. 51 00:02:31,301 --> 00:02:34,834 Once the update is complete, let's exit it. 52 00:02:34,834 --> 00:02:38,834 Now let's use docker commit command, followed by the container name 53 00:02:38,834 --> 00:02:42,601 which is my-ubuntu and update name in the format 54 00:02:42,634 --> 00:02:46,367 of Docker Hub repo images. We have kept it as 55 00:02:46,367 --> 00:02:51,034 updated-ubuntu:1.0. Once we enter it, the update 56 00:02:51,034 --> 00:02:53,534 will be committed to our Docker Hub repo. 57 00:02:53,734 --> 00:02:57,134 As you may have guessed, it is essential for us to be 58 00:02:57,134 --> 00:03:00,467 logged into our Docker Hub account to use this demo. 59 00:03:00,467 --> 00:03:03,667 The updated container is committed as the image 60 00:03:03,667 --> 00:03:07,367 as its read/write layer turns read only and 61 00:03:07,367 --> 00:03:10,867 is tagged on top of previous layers of the former image. 62 00:03:11,234 --> 00:03:15,567 So instead of containers, if we list out the images, 63 00:03:15,567 --> 00:03:18,034 we can find the updated one which can 64 00:03:18,034 --> 00:03:20,934 be directly run as a container and we won't have 65 00:03:20,934 --> 00:03:22,434 to rerun the update command. 66 00:03:22,734 --> 00:03:25,901 This helps maintaining the versions of Docker Images. 67 00:03:26,501 --> 00:03:29,734 In next lecture, we will learn about port mapping.