1 00:00:00,766 --> 00:00:07,400 In first demo we had installed and run nginx on Ubuntu 16.04 locally. 2 00:00:07,400 --> 00:00:11,900 In the demo after that, we installed Docker. 3 00:00:12,300 --> 00:00:15,566 You might find a pattern here and you you might have been 4 00:00:15,566 --> 00:00:18,766 able to figure out, that in this demo we are going to run 5 00:00:18,766 --> 00:00:21,100 nginx as a Docker container. 6 00:00:21,233 --> 00:00:25,466 Unlike hello-world container, we will do this in a bit more elaborate way. 7 00:00:25,466 --> 00:00:28,966 Let's start with pulling an image called nginx:latest 8 00:00:28,966 --> 00:00:31,633 from Docker hub's nginx repository, 9 00:00:31,633 --> 00:00:37,133 by running the command 'docker image pull nginx:latest'. 10 00:00:37,800 --> 00:00:43,600 This will download or pull an image called nginx with latest tag 11 00:00:43,600 --> 00:00:46,233 which can later be run as a container. 12 00:00:46,233 --> 00:00:50,466 Let's see if we have got our image, run 'docker images' command 13 00:00:50,466 --> 00:00:52,166 to show the list of images. 14 00:00:53,433 --> 00:00:56,133 And here we go, we have two images, 15 00:00:56,133 --> 00:01:00,666 first is hello-world, which we used in the last demo and second 16 00:01:00,666 --> 00:01:03,966 is nginx, which we are using in this demo. 17 00:01:04,166 --> 00:01:08,800 Both of them have TAG called latest and they have different sizes. 18 00:01:08,800 --> 00:01:14,566 Now let's run this image as a container using 'docker container run' command 19 00:01:14,566 --> 00:01:19,233 followed by -itd flag and name our container 20 00:01:19,233 --> 00:01:23,100 web-server-nginx. With -p command, 21 00:01:23,300 --> 00:01:29,133 we are mapping the Port 8080 of our local machine to container's port 80. 22 00:01:30,466 --> 00:01:34,800 And finally we are mentioning the image name nginx:latest 23 00:01:34,800 --> 00:01:36,800 which we have just pulled recently. 24 00:01:37,200 --> 00:01:42,233 What we got is a container id of the nginx container. 25 00:01:43,300 --> 00:01:48,166 I know all of this terminology sounds pretty new and pretty abrupt. 26 00:01:48,166 --> 00:01:51,833 But don't worry, in this demo, our only purpose 27 00:01:51,833 --> 00:01:53,733 is to run nginx successfully. 28 00:01:55,333 --> 00:01:58,633 We will go through all of these terms in sufficient details 29 00:01:58,633 --> 00:02:02,366 when the time arrives. Let's verify that our container is 30 00:02:02,366 --> 00:02:07,900 running by running the command 'docker ps -a' and as you can see, 31 00:02:07,900 --> 00:02:12,032 web-server nginx container is running which is built upon 32 00:02:12,032 --> 00:02:14,400 image called nginx:latest. 33 00:02:14,400 --> 00:02:18,466 Finally, let's see the output of this container by going 34 00:02:18,466 --> 00:02:23,366 to the web browser and opening our localhost port 8080 35 00:02:23,500 --> 00:02:25,433 and it works successfully.