1 00:00:06,750 --> 00:00:09,510 - So the next assignment was about containers. 2 00:00:09,510 --> 00:00:10,680 Start a container based 3 00:00:10,680 --> 00:00:14,190 on the docker.io/library/nginx:latest image, 4 00:00:14,190 --> 00:00:16,890 and ensure that it meets the following requirements. 5 00:00:16,890 --> 00:00:19,470 So the container is started by the root user. 6 00:00:19,470 --> 00:00:20,820 The container main application 7 00:00:20,820 --> 00:00:23,850 can be reached on localhost port 8080. 8 00:00:23,850 --> 00:00:27,183 An environment variable is set as type=webserver. 9 00:00:27,183 --> 00:00:30,210 The container is started as a background process. 10 00:00:30,210 --> 00:00:31,470 And within the container, 11 00:00:31,470 --> 00:00:33,510 a directory /data is presented 12 00:00:33,510 --> 00:00:36,270 and all files written to the directory are mapped 13 00:00:36,270 --> 00:00:39,900 to the directory /root/data. 14 00:00:39,900 --> 00:00:44,220 So that sounds like a lot, but really it's just one command. 15 00:00:44,220 --> 00:00:45,183 Let's check it out. 16 00:00:47,910 --> 00:00:49,740 So I'm in a root shell already. 17 00:00:49,740 --> 00:00:50,940 That's good. 18 00:00:50,940 --> 00:00:55,940 So I can use podman, podman run, with a lot of options. 19 00:00:56,100 --> 00:00:58,770 So we need to make sure that the main application 20 00:00:58,770 --> 00:01:01,230 can be reached on localhost port 8080. 21 00:01:01,230 --> 00:01:05,553 So it's -p 8080:80, that's the port forwarding. 22 00:01:06,690 --> 00:01:09,223 Then we need to set an environment variable, 23 00:01:09,223 --> 00:01:12,483 - - env type=webserver, 24 00:01:15,210 --> 00:01:18,600 it needs to be a background process, that's -d, 25 00:01:18,600 --> 00:01:23,600 and we need -v for the byte mount, /root/data:/data. 26 00:01:27,150 --> 00:01:28,800 And as this is a centralize system 27 00:01:28,800 --> 00:01:32,100 with podman and which is using asset Linux, 28 00:01:32,100 --> 00:01:34,083 don't forget the uppercase Z. 29 00:01:34,980 --> 00:01:37,800 And also, let's not forget the name of the image, 30 00:01:37,800 --> 00:01:42,800 docker.io/library/nginx:latest. 31 00:01:45,720 --> 00:01:49,050 My advice, if in the exam you get a question 32 00:01:49,050 --> 00:01:50,580 where they are so specific 33 00:01:50,580 --> 00:01:52,980 about the fully qualified image name 34 00:01:52,980 --> 00:01:55,230 then use the fully qualified image name, 35 00:01:55,230 --> 00:01:57,450 you might be evaluated 36 00:01:57,450 --> 00:02:00,213 and they might check if you have really done that. 37 00:02:01,200 --> 00:02:02,430 Now, there's one little thing, 38 00:02:02,430 --> 00:02:03,360 and this little thing is 39 00:02:03,360 --> 00:02:05,910 that we need to map to the directory data 40 00:02:05,910 --> 00:02:07,500 in the route home directory, 41 00:02:07,500 --> 00:02:10,440 so I'm using control A to bring my cursor to the beginning 42 00:02:10,440 --> 00:02:14,370 and I'm using "mkdir data" to create this directory 43 00:02:14,370 --> 00:02:15,770 in the route home directory. 44 00:02:17,880 --> 00:02:20,520 So, podman ps is showing 45 00:02:20,520 --> 00:02:23,940 that the nginx container is actually running. 46 00:02:23,940 --> 00:02:24,773 So that's all.