1
00:00:04,300 --> 00:00:05,100
All right.

2
00:00:05,190 --> 00:00:08,250
We have just successfully pulled the python imager.

3
00:00:08,250 --> 00:00:10,560
It is around 1 gigabyte in size.

4
00:00:10,640 --> 00:00:16,140
And afterwards we hope read that the python container and inside of the interactive session with Python

5
00:00:16,140 --> 00:00:19,610
interpreter we executed some Python commands.

6
00:00:19,620 --> 00:00:26,610
Now it's a good time to create the very small tiny python program and run it inside of the Python container

7
00:00:27,170 --> 00:00:30,990
and let us simply print Hello from Python container to the terminal.

8
00:00:30,990 --> 00:00:36,300
Very simple application let's create the new folder inside of the container folder.

9
00:00:36,330 --> 00:00:40,470
Let me clear terminal here and let's do the visual studio code.

10
00:00:40,500 --> 00:00:42,770
Let's close in this similar file.

11
00:00:42,780 --> 00:00:44,060
We don't need it anymore.

12
00:00:44,190 --> 00:00:46,030
Collapse and Gen X do folder.

13
00:00:46,050 --> 00:00:47,610
We don't need it anymore as well.

14
00:00:47,850 --> 00:00:53,000
And here let's create new folder by clicking on this icon and please make sure that you will create

15
00:00:53,000 --> 00:01:00,630
a new folder near and Gen X folders and let's type here by then name for new folder and inside of this

16
00:01:00,630 --> 00:01:02,520
folder list create new file.

17
00:01:02,520 --> 00:01:06,810
Please select this folder with your mouse and create your file like so.

18
00:01:06,840 --> 00:01:13,060
And the new file name will be simply Hello World NPI.

19
00:01:13,170 --> 00:01:16,350
And next Let's type here one line.

20
00:01:16,350 --> 00:01:20,520
Let's install also extension that is recommended for this file type.

21
00:01:20,610 --> 00:01:23,450
It will be installed automatically by the US Code.

22
00:01:23,580 --> 00:01:30,120
And meanwhile Wild is installing the let's hide this left pane and type here one single line of code

23
00:01:30,350 --> 00:01:30,890
print.

24
00:01:30,990 --> 00:01:39,540
And here will be a hello from the Python container because we will run this code inside of the Python

25
00:01:39,540 --> 00:01:40,110
container.

26
00:01:40,620 --> 00:01:42,130
Let's save the file.

27
00:01:42,160 --> 00:01:47,560
Come on s let me basically close those pop ups and the next.

28
00:01:47,610 --> 00:01:50,640
Let's try it to execute this file.

29
00:01:50,640 --> 00:01:55,350
Hello role would be using Python interpreter inside of the Python container.

30
00:01:55,920 --> 00:02:00,300
Let's go to terminal and the let's see deed to Python folder.

31
00:02:00,320 --> 00:02:08,039
I am currently in containers folder city to buy it on and if I list files here I will see only one file

32
00:02:08,160 --> 00:02:10,030
Hello rolled by.

33
00:02:10,410 --> 00:02:15,740
Now let's create new Python container and let's try it or run this file there.

34
00:02:16,240 --> 00:02:17,520
Let's put it in the following way.

35
00:02:17,730 --> 00:02:18,300
Let me clear.

36
00:02:18,300 --> 00:02:18,860
Terminal.

37
00:02:19,110 --> 00:02:21,230
Let's use Docker run command.

38
00:02:21,250 --> 00:02:22,310
That's 18.

39
00:02:22,350 --> 00:02:25,560
And next comes name of the image by them.

40
00:02:25,560 --> 00:02:34,350
And now somehow we need to tell Python which file it must execute and this file is located on our computer

41
00:02:34,440 --> 00:02:39,750
and it is located basically in this folder where we are currently running docker container.

42
00:02:40,680 --> 00:02:48,130
But how we're able to tell container which file it should execute answer was very simple.

43
00:02:48,210 --> 00:02:50,350
Often name of the image here.

44
00:02:50,410 --> 00:02:57,460
We could specify a command custom command that will be executed instead of the built in default command

45
00:02:58,300 --> 00:03:02,580
request that the default command for this container is Python 3.

46
00:03:02,830 --> 00:03:06,880
And one container is started without any additional options like.

47
00:03:06,880 --> 00:03:12,140
So as you see now on the screen then Python 3 process will be started.

48
00:03:12,370 --> 00:03:18,860
But instead we want to execute Hello rolled by a file using by the three interpreter.

49
00:03:19,210 --> 00:03:26,990
And for that we could simply type here comment that we want to execute after Image Name Python 3.

50
00:03:27,640 --> 00:03:30,130
And here we'll be the name of the file.

51
00:03:30,130 --> 00:03:30,850
Hello.

52
00:03:30,940 --> 00:03:37,720
This rolled not by Let's not press enter and see what will happen.

53
00:03:37,890 --> 00:03:44,190
Enter and I see error Python 3 can't open the file Hello rolled.

54
00:03:44,250 --> 00:03:44,800
Goodbye.

55
00:03:44,830 --> 00:03:48,050
No such file or directory.

56
00:03:48,050 --> 00:03:54,620
Now please stop this video and try to find out the reason why we get this error.

57
00:03:54,770 --> 00:04:00,410
Please note that you already have knowledge how to fix this problem just try to think about that a bit

58
00:04:00,860 --> 00:04:03,590
please post this video and fix this error

59
00:04:07,980 --> 00:04:09,250
let's do that together.

60
00:04:09,360 --> 00:04:11,130
Answer is very simple.

61
00:04:11,130 --> 00:04:16,290
This command Python container tries to execute inside of the container.

62
00:04:17,279 --> 00:04:22,180
And it looks for Hello rolled by a file inside of the container.

63
00:04:22,650 --> 00:04:26,910
But now this file is located locally on our computer.

64
00:04:26,940 --> 00:04:35,580
Here is this file and in order to transfer this file to a container we need to create volume mapping.

65
00:04:35,580 --> 00:04:38,220
Same as we did with engine these containers.

66
00:04:38,230 --> 00:04:39,920
Do remember that.

67
00:04:39,930 --> 00:04:44,040
Let's do that no longer run this item.

68
00:04:44,160 --> 00:04:45,630
And next comes volume.

69
00:04:45,660 --> 00:04:47,500
Option desk view here.

70
00:04:47,550 --> 00:04:54,060
I could use either absolute path to current folder Python folder that has Hello rolled by a file or

71
00:04:54,060 --> 00:04:54,720
I could use.

72
00:04:54,720 --> 00:04:55,720
Same as before.

73
00:04:55,910 --> 00:04:57,610
B w d variable.

74
00:04:58,150 --> 00:05:01,040
Let's use variable dollar assign B W.

75
00:05:01,230 --> 00:05:02,490
Next comes column.

76
00:05:02,610 --> 00:05:09,800
And afterwards we need to specify absolute path to internal folder inside of the container.

77
00:05:09,860 --> 00:05:15,780
Recall that with engine X we have used actually default folder that was used for separating the different

78
00:05:15,780 --> 00:05:22,710
files to clients but in such case we are actually able to use any folder you like we could use even

79
00:05:22,860 --> 00:05:25,640
root folder but it's not a good practice to do so.

80
00:05:25,650 --> 00:05:32,640
This way let's use a custom folder name for example slash up like so you could use any folder name you

81
00:05:32,640 --> 00:05:35,640
like here and next comes name of the image.

82
00:05:35,670 --> 00:05:38,600
Same as in this command in our case python.

83
00:05:39,750 --> 00:05:47,130
And afterwards let's override default Python 3 command with custom command by then 3 and here we'll

84
00:05:47,130 --> 00:05:48,520
be at name of the file.

85
00:05:48,540 --> 00:05:49,000
Hello.

86
00:05:49,020 --> 00:05:52,590
This rolled dot my question to you.

87
00:05:52,590 --> 00:05:54,360
Will it work or not.

88
00:05:54,360 --> 00:05:55,510
Let's try it.

89
00:05:55,530 --> 00:06:03,310
Press enter again can't open file Hello rolled the API could you please find error in this comment.

90
00:06:03,330 --> 00:06:04,800
If so please fix it yourself.

91
00:06:09,660 --> 00:06:09,960
Great.

92
00:06:09,990 --> 00:06:11,260
Let's fix it together.

93
00:06:11,370 --> 00:06:14,310
And here instead of simply Hello World.

94
00:06:14,700 --> 00:06:19,890
We need to specify path to Hello world API instead of the container.

95
00:06:19,890 --> 00:06:25,260
Here we have mapped this folder to this folder and that's way here before.

96
00:06:25,260 --> 00:06:26,100
File Name.

97
00:06:26,100 --> 00:06:30,610
We need to specify slash up like so because now.

98
00:06:30,630 --> 00:06:31,530
Hello world.

99
00:06:31,660 --> 00:06:39,250
A file will be mapped from local folder by them into the app folder inside the container.

100
00:06:39,330 --> 00:06:43,920
That's why here we need to specify this folder name as well.

101
00:06:43,920 --> 00:06:46,640
Let's now execute this command enter.

102
00:06:46,650 --> 00:06:49,800
And now I see Hello from the Python container.

103
00:06:49,800 --> 00:06:52,950
Finally it works as expected.

104
00:06:52,950 --> 00:06:59,280
Also we're actually able to get rid of this folder of graphics here by specifying an additional option

105
00:06:59,370 --> 00:07:01,820
that double your working directory.

106
00:07:01,920 --> 00:07:02,780
Let's do so.

107
00:07:02,910 --> 00:07:04,230
Let's modify this command.

108
00:07:04,290 --> 00:07:08,940
Let me remove up folder here and somewhere here.

109
00:07:08,970 --> 00:07:12,610
After this the option let's add desk double your option.

110
00:07:12,630 --> 00:07:14,550
That extends for walking directory.

111
00:07:14,910 --> 00:07:21,630
And here let us simply type up like so last press enter and they see same result.

112
00:07:21,660 --> 00:07:23,970
Hello from the Python container.

113
00:07:23,970 --> 00:07:30,240
That's how we were able to successfully create the python container map volume from our local computer

114
00:07:30,270 --> 00:07:36,140
to container and execute specific application file inside of the container.

115
00:07:36,140 --> 00:07:41,340
Next you'll get a small challenge and you will need to create a bit more complicated program using Python

116
00:07:41,610 --> 00:07:46,170
and executed inside of the Python container challenge task comes next.

117
00:07:46,180 --> 00:07:46,470
My.

