1
00:00:02,320 --> 00:00:04,920
<v ->Now for working with images and containers,</v>

2
00:00:04,920 --> 00:00:06,910
we got a couple of core commands

3
00:00:06,910 --> 00:00:08,880
which you should keep in mind.

4
00:00:08,880 --> 00:00:10,910
Of course there is docker build,

5
00:00:10,910 --> 00:00:13,780
and docker build can be used to build an image

6
00:00:13,780 --> 00:00:15,720
based on a Dockerfile.

7
00:00:15,720 --> 00:00:18,140
We specify a Build Context,

8
00:00:18,140 --> 00:00:20,060
so the path to the folder

9
00:00:20,060 --> 00:00:21,860
which contains the Dockerfile

10
00:00:21,860 --> 00:00:23,600
and the folder in which

11
00:00:23,600 --> 00:00:25,160
this image should be built

12
00:00:25,160 --> 00:00:27,380
and we can also give our image a name

13
00:00:27,380 --> 00:00:29,080
and a tag to ensure

14
00:00:29,080 --> 00:00:31,500
that we can easily identify and use it

15
00:00:31,500 --> 00:00:34,128
to make it unique and with the tag system,

16
00:00:34,128 --> 00:00:36,520
we can also version our image.

17
00:00:36,520 --> 00:00:40,340
And we can have one image category so to say

18
00:00:40,340 --> 00:00:44,050
and then have different sub versions of that same image

19
00:00:44,050 --> 00:00:45,430
in that category.

20
00:00:45,430 --> 00:00:47,360
Like for the official node image,

21
00:00:47,360 --> 00:00:49,970
where we have the 12 and 14 tag

22
00:00:49,970 --> 00:00:52,530
to draw up different versions of Node JS

23
00:00:52,530 --> 00:00:54,220
If we use one at the same image

24
00:00:54,220 --> 00:00:55,610
with a different tag.

25
00:00:55,610 --> 00:00:57,570
That's the idea here.

26
00:00:57,570 --> 00:01:00,070
We then can run an image as a container

27
00:01:00,070 --> 00:01:02,380
with the Docker run command,

28
00:01:02,380 --> 00:01:04,670
there we could give this container a name,

29
00:01:04,670 --> 00:01:06,250
with dash dash name,

30
00:01:06,250 --> 00:01:07,850
we can auto remove it

31
00:01:07,850 --> 00:01:10,700
when it's stopped with dash dash RM,

32
00:01:10,700 --> 00:01:13,860
and we can run it in detached mode with dash D.

33
00:01:13,860 --> 00:01:16,090
Of course, there are more options we can set

34
00:01:16,090 --> 00:01:18,070
which you also saw throughout this course.

35
00:01:18,070 --> 00:01:19,970
But these are some of the most important

36
00:01:19,970 --> 00:01:21,910
and commonly used ones.

37
00:01:21,910 --> 00:01:23,250
When we run a container,

38
00:01:23,250 --> 00:01:26,460
we also need to provide the name and tag of an image

39
00:01:26,460 --> 00:01:28,480
on which this container should be based

40
00:01:28,480 --> 00:01:32,283
because the container always needs to be based on an image.

41
00:01:33,200 --> 00:01:37,230
We then also can share images with Docker push

42
00:01:37,230 --> 00:01:38,990
and Docker pull.

43
00:01:38,990 --> 00:01:40,980
And there we just have to keep in mind

44
00:01:40,980 --> 00:01:43,810
that the image name, now needs to be the name

45
00:01:43,810 --> 00:01:46,610
of the repository on DockerHub.

46
00:01:46,610 --> 00:01:50,070
You can also use our repository standard DockerHub.

47
00:01:50,070 --> 00:01:50,980
In that case,

48
00:01:50,980 --> 00:01:53,390
the image name would be the full URL

49
00:01:53,390 --> 00:01:56,470
to that repository on that other registry.

50
00:01:56,470 --> 00:01:57,650
But with DockerHub

51
00:01:57,650 --> 00:01:59,070
it's enough if your image name

52
00:01:59,070 --> 00:02:01,000
is your account name slash

53
00:02:01,000 --> 00:02:01,833
and then your image name

54
00:02:01,833 --> 00:02:05,830
and you need to label your images such locally

55
00:02:05,830 --> 00:02:07,280
on your local machine

56
00:02:07,280 --> 00:02:09,060
so that you can then push them.

57
00:02:09,060 --> 00:02:10,850
Of course that's also something we saw

58
00:02:10,850 --> 00:02:12,603
in detail throughout this course.

