1
00:00:00,000 --> 00:00:11,940
Containers are based on images, and you better should know a bit about images as well.

2
00:00:11,940 --> 00:00:18,440
So before running a container, the container image is fetched and stored locally.

3
00:00:18,440 --> 00:00:22,799
All images are stored on the container host by default, and you can use Docker images

4
00:00:22,799 --> 00:00:25,480
for a list of current images.

5
00:00:25,480 --> 00:00:30,280
The command docker inspect images is a cool command because it will show you exactly what

6
00:00:30,280 --> 00:00:33,439
happens while starting the container.

7
00:00:33,439 --> 00:00:38,840
And if you don't need a specific container image anymore, you can use docker rmi followed

8
00:00:38,840 --> 00:00:42,639
by the name of the image to remove the image.

9
00:00:42,639 --> 00:00:45,599
It's also possible to work with custom images.

10
00:00:45,599 --> 00:00:49,360
To do so, you would use the docker file.

11
00:00:49,360 --> 00:00:54,000
On Red Hat based Popman systems, container file is commonly used as an alternative name

12
00:00:54,000 --> 00:00:55,799
for docker file.

13
00:00:55,799 --> 00:01:00,799
For an example, you can check the docker file in the course git repository.

14
00:01:00,799 --> 00:01:06,160
Now you can build your own container image based on the instructions in the docker file.

15
00:01:06,160 --> 00:01:08,760
Use docker build minus T image name.

16
00:01:08,760 --> 00:01:11,279
That's the name of the image that you want to create.

17
00:01:11,279 --> 00:01:16,419
Dot slash name of the docker file directory to build the container image.

18
00:01:16,419 --> 00:01:20,800
And after creating the image is added to the list of images on your system.

19
00:01:20,800 --> 00:01:21,800
Let me show you.

20
00:01:22,400 --> 00:01:25,440
So to start with, I want to show you docker images.

21
00:01:25,440 --> 00:01:28,160
These are the images that have been fetched so far.

22
00:01:28,160 --> 00:01:29,160
And do you see that?

23
00:01:29,160 --> 00:01:31,959
The busy box is only four megabytes.

24
00:01:31,959 --> 00:01:38,919
Now let's use docker inspect on nginx.

25
00:01:38,919 --> 00:01:42,279
Well I would like to use it in a slightly different way.

26
00:01:42,279 --> 00:01:46,000
Let's use docker image inspect on nginx.

27
00:01:46,000 --> 00:01:49,160
Because docker inspect, you don't tell docker what to expect.

28
00:01:49,160 --> 00:01:50,599
So it needs to guess.

29
00:01:50,599 --> 00:01:54,800
Docker image inspect, it knows that you want to inspect an image.

30
00:01:54,800 --> 00:02:00,199
Without the image, it will also find the container with the name nginx and it will show you the

31
00:02:00,199 --> 00:02:02,559
configuration of that.

32
00:02:02,559 --> 00:02:06,900
Now here we can see the configuration behind the container image.

33
00:02:06,900 --> 00:02:11,240
With the path variable, with the default command that it is running.

34
00:02:11,240 --> 00:02:14,320
And more about what the container image is doing.

35
00:02:14,320 --> 00:02:18,399
And that can be very useful to figure out what is going to happen before you actually

36
00:02:18,520 --> 00:02:20,119
do it.

37
00:02:20,119 --> 00:02:23,160
Now let's go into the course git repository.

38
00:02:23,160 --> 00:02:31,160
To start with, I need to make it available here using git clone https://github.com

39
00:02:31,160 --> 00:02:35,800
slash sander van vugt slash linux plus.

40
00:02:35,800 --> 00:02:40,800
All right, so in the linux plus git repository, there's a subdirectory with the name dockerfile

41
00:02:40,800 --> 00:02:43,240
in which you find a dockerfile.

42
00:02:43,240 --> 00:02:44,800
So what is in this dockerfile?

43
00:02:45,039 --> 00:02:49,600
Well, a simple example of a dockerfile specifying from alpine.

44
00:02:49,600 --> 00:02:55,000
So choosing alpine, one of these base cloud image as a foundational image.

45
00:02:55,000 --> 00:02:56,919
Then we have the maintainer.

46
00:02:56,919 --> 00:02:58,119
That's for politeness sake.

47
00:02:58,119 --> 00:03:03,880
It's open source and an open source is always nice if you can find your original developer.

48
00:03:03,880 --> 00:03:06,380
Then we use add to add a file.

49
00:03:06,380 --> 00:03:11,360
It's kind of a dummy here, but it's an interesting way to show you how you can add a file to

50
00:03:11,360 --> 00:03:13,679
your container image.

51
00:03:13,679 --> 00:03:16,520
Then it is installing some cool software.

52
00:03:16,520 --> 00:03:22,600
The run command is running while you build your custom container image.

53
00:03:22,600 --> 00:03:28,199
So apk is the alpine package manager is going to add bash as well as nmap.

54
00:03:28,199 --> 00:03:32,919
Then the entry point is specifying the default command and this entry point works with the

55
00:03:32,919 --> 00:03:39,000
argument minus sn 172.17.0.0.

56
00:03:39,000 --> 00:03:48,839
So if I want to use it, I can use docker build minus t altmap.

57
00:03:48,839 --> 00:03:54,520
Minus t is a tag and this tag is really the name that you are going to assign and I'm

58
00:03:54,520 --> 00:03:56,960
doing that on dot.

59
00:03:56,960 --> 00:04:00,479
Now this is telling you that the legacy builder is deprecated.

60
00:04:00,479 --> 00:04:02,880
Please ignore that for now it's still used.

61
00:04:02,880 --> 00:04:08,800
Now if I use docker images, now we can see that altmap is now available.

62
00:04:08,800 --> 00:04:15,919
And if I use docker run altmap, it is going to run its primary application.

63
00:04:15,919 --> 00:04:21,440
And this primary application is nmap and here you can see that nmap is doing its work and

64
00:04:21,440 --> 00:04:24,079
might give us a result in a little bit.

65
00:04:24,079 --> 00:04:27,000
It's not about the result of the nmap application.

66
00:04:27,000 --> 00:04:32,440
It's about the fact that I created a container image that is running this application.

67
00:04:32,440 --> 00:04:33,920
Why would you want to do that?

68
00:04:33,920 --> 00:04:38,119
Well, containers are cool because they run in complete isolation.

69
00:04:38,119 --> 00:04:41,239
No risk for any other applications in your environment.

