YouTube2Text

ARCHER2 - Containers for Reproducible Research: Introduction to Podman and Singularity - Session 2 — Transcript

by ARCHER2 HPC · 11,863 words · 1,889 segments · language en · Watch on YouTube

Full transcript

  1. 0:08Okay, I think we can start. So, uh
  2. 0:11before uh the launch break, we have seen
  3. 0:14how to uh use uh containers, how to run
  4. 0:18them on on our laptop,
  5. 0:22uh find them, download them and run
  6. 0:25them. Um
  7. 0:29now what we will see is how to how we
  8. 0:32can create why I say containers but yeah
  9. 0:34container images. Uh now we will see how
  10. 0:39we can create a new uh image. uh we will
  11. 0:43use
  12. 0:45a a sample that will take a image uh and
  13. 0:50we'll install pi python on top of it and
  14. 0:54see how uh how that will work in case
  15. 0:58that we want to uh
  16. 1:01uh to create our own uh container.
  17. 1:07Uh so yeah we are now in this lesson
  18. 1:14the good practice before writing the
  19. 1:18let's say the recipe docker file uh will
  20. 1:21be to uh test the commands that we want
  21. 1:24to uh use when build when in the new
  22. 1:28image. So what I will do is I will uh
  23. 1:33uh create a new container
  24. 1:39using the
  25. 1:41Alpine image.
  26. 1:47So we're here and uh I will check if a
  27. 1:50Python is available there. That is it's
  28. 1:55not. So I will need to uh update install
  29. 2:00uh Python there. If I
  30. 2:05one thing that I need to be familiar
  31. 2:07when I work with the different Linux
  32. 2:09flavors is how to install a software. Uh
  33. 2:14if I use Ubuntu will be AP.
  34. 2:17Uh I think Fedora use uh or uh Santos
  35. 2:24use
  36. 2:25jam I think it's yeah each uh Linux
  37. 2:29flavor we have a different way to in of
  38. 2:32installing software in this case for
  39. 2:36Alpine APK APK app
  40. 2:41um well it's like a minus update would
  41. 2:46be Python
  42. 2:48And I want also to install py3.p
  43. 2:54and python
  44. 2:573 that
  45. 3:00this is we are following. I will copy
  46. 3:02that on the chat.
  47. 3:05We're following this uh lesson here.
  48. 3:10So if I execute that I check that uh
  49. 3:14what I want to uh yeah I the
  50. 3:18installation works. Now I check that the
  51. 3:21Python 3.
  52. 3:24Yeah I check the version. This is the
  53. 3:26version that I want. I check that the
  54. 3:29command works that there are no typos
  55. 3:32nothing.
  56. 3:34So uh what I will do now is I will uh
  57. 3:38yeah I can go exit and uh this uh
  58. 3:42command I will add it to a to the docker
  59. 3:47a docker file
  60. 3:49uh in uh I'm in the desktop directory
  61. 3:52and I download this uh
  62. 3:56I will copy that in the chat the
  63. 3:58template to create a container
  64. 4:02that is The template is here. Copy link.
  65. 4:10So I uh downloaded that file and I uh uh
  66. 4:15unse that file. So I can do uh cd
  67. 4:20uh
  68. 4:23man intro. So if I do I see that I have
  69. 4:27two directories basic and sum. So I if I
  70. 4:30go to basic
  71. 4:34dos I see that I have a docker file
  72. 4:37there uh that I can uh edit.
  73. 4:42So if I do edit uh docker file you can
  74. 4:45either use edit or use u notepad or uh
  75. 4:50whatever you feel more confident editing
  76. 4:53the the file.
  77. 4:55You see that this is uh
  78. 4:59the docker file is the recipe that I
  79. 5:02will use or let's say kind of source
  80. 5:05code / recipe that I will use to build a
  81. 5:09container
  82. 5:14here in from I need to specify the
  83. 5:16existing image in in our case we'll use
  84. 5:20uh alpine
  85. 5:23but if you want you can use Wu or you
  86. 5:26can use any other image
  87. 5:30run will contains uh the commands that
  88. 5:34uh you executed on the cell. In our case
  89. 5:37we will install Python
  90. 5:41and uh cmd is the command that will run
  91. 5:45by default. That means that when you uh
  92. 5:48when you uh create the container and you
  93. 5:50don't run it, this will be the command
  94. 5:53that will uh run by default.
  95. 5:58So if we try this will be
  96. 6:03a time
  97. 6:10drum will be
  98. 6:15apk add
  99. 6:20minus minus update
  100. 6:22python 3.
  101. 6:25See if I remember the
  102. 6:36uh
  103. 6:37py3
  104. 6:41and the python
  105. 6:443 there
  106. 6:48and the command that you want to use by
  107. 6:50default uh I will need to uh this will
  108. 6:54be like a list of uh
  109. 6:57uh
  110. 7:00a list of the with a command and options
  111. 7:03that and this will be separated by a
  112. 7:08comma
  113. 7:09or
  114. 7:21let's see if so if will be by if I want
  115. 7:25to execute if I want to uh if I
  116. 7:28introduce a has h has a comment. So I
  117. 7:32want to use Python 3 minus minus
  118. 7:35version.
  119. 7:38I will need to do a Python 3
  120. 7:43minus minus version.
  121. 7:47This will be the command that I will run
  122. 7:49by default.
  123. 7:53Now to save is like a alt f
  124. 7:59save alt f
  125. 8:02x.
  126. 8:06Now if I do um
  127. 8:14yeah if I do this I see that yeah the
  128. 8:17the light has changed. We have a docker
  129. 8:19file.
  130. 8:21So now we I can start building my my new
  131. 8:25container. How to do that? Sorry, my new
  132. 8:28image
  133. 8:30map
  134. 8:32image build
  135. 8:36minus t. And here I will need to specify
  136. 8:42the
  137. 8:44the repository or let's see the URL that
  138. 8:48I want to uh where where I want to you
  139. 8:50to save the
  140. 8:52uh the image my username and the name of
  141. 8:56the image. So this will be
  142. 8:59uh I mean I can't type here just
  143. 9:05so it will be URL
  144. 9:08username
  145. 9:12and the name let's see here
  146. 9:21so URL will be docker
  147. 9:25io.
  148. 9:28My username on docker is fr
  149. 9:33and the image name will be alpine
  150. 9:38uh python. I I will call it
  151. 9:45um
  152. 9:47don't forget that I need to specify
  153. 9:49where the directory where the docker
  154. 9:51file is. In our case, I will specify it
  155. 9:55with a yeah with a dot. But that that
  156. 9:58means that I'm the current is the docker
  157. 10:02the
  158. 10:05recipe of the docker file is in the same
  159. 10:07directory where I'm running this
  160. 10:09command.
  161. 10:11Let's see if uh that works.
  162. 10:16So you see that it's executing the
  163. 10:23installation
  164. 10:26and the
  165. 10:28our by default use the target latest
  166. 10:33and we have our new image. So if I we do
  167. 10:37mount
  168. 10:41uh image ls
  169. 10:44well I have a lot of them but this uh
  170. 10:47this is the the one that I have uh I
  171. 10:52made 20 seconds ago.
  172. 11:02Actually, I will delete that one to make
  173. 11:04it some space here.
  174. 11:08This is called
  175. 11:10image.
  176. 11:27So this is the So now I can try to run
  177. 11:30this uh image here. So if I do uh no not
  178. 11:35docker all mount
  179. 11:38container run
  180. 11:42and I can specify the whole uh
  181. 11:46thing but I don't know if it will work
  182. 11:49if I specify only this.
  183. 11:55Well, okay, it works because there are
  184. 11:57no no other images that uh has the same
  185. 12:01that uh name.
  186. 12:03And you see that the output is the
  187. 12:06command that I have uh specified
  188. 12:10before.
  189. 12:24That's a good question. There is a
  190. 12:26question if the in the if uh for the
  191. 12:29docker file if uh we build an image
  192. 12:33completely from a scratch.
  193. 12:35Actually,
  194. 12:41I was trying to think that uh
  195. 12:46I'm I mean I would need to double check,
  196. 12:48but I'm not sure if uh you can build
  197. 12:51something I would say entirely from a
  198. 12:54scratch. You will need let's say the
  199. 12:57minimum that you need is a operating
  200. 13:00system to build on top of. So uh the
  201. 13:05lowest that would be like a alpine wu.
  202. 13:15So yeah I'm not I'm not sure if that
  203. 13:17would be po that's a good question. I
  204. 13:19was I don't know if that would be
  205. 13:20possible.
  206. 13:22Uh you will need a operating system to
  207. 13:25build on top of uh
  208. 13:28that. I was thinking you need
  209. 13:33yeah I I can double check my answer
  210. 13:35later but uh
  211. 13:38yeah from you will specify the image
  212. 13:41that in this case for instance if uh uh
  213. 13:46or software will be
  214. 13:48our software will be Python the my
  215. 13:52recommendation the recommendation is to
  216. 13:53use a image that is already
  217. 13:56built. So uh rather than starting with
  218. 13:59Alpi, you will start with the Python
  219. 14:04Python 3 the version that you want to
  220. 14:07use minus Al PI
  221. 14:11and you will get the
  222. 14:15uh
  223. 14:19there is we can do a
  224. 14:24Uh
  225. 14:30yeah, I was thinking we can do maybe a
  226. 14:32small exercise of like of
  227. 14:37well let me we can see how to create the
  228. 14:41image
  229. 14:43or the next. So maybe we can do a small
  230. 14:46exercise. Rather than installing Python,
  231. 14:48we can install R and build the build
  232. 14:54uh the image and see
  233. 14:58how uh
  234. 15:00how it looks like.
  235. 15:05I will give you uh five minutes. So the
  236. 15:09yeah the to try that is like
  237. 15:18This one.
  238. 15:35I will give you five minutes and you can
  239. 15:37see how to edit the docker file and
  240. 15:41install.
  241. 15:44R.
  242. 15:51Yeah, I think we can solve the exercise
  243. 15:54together. I uh
  244. 15:58so what we can do is we can uh
  245. 16:07let's see if I see this available here.
  246. 16:13Okay.
  247. 16:15So, uh I will see if I can copy.
  248. 16:31Okay. So, yeah, I can do a copy of the
  249. 16:33whole directory. So I I created the
  250. 16:36directory called exercise size and uh in
  251. 16:39that case we don't destroy the rest the
  252. 16:41basic uh uh docker file that we had
  253. 16:44before I edit this docker file actually
  254. 16:48what first first thing because we need
  255. 16:52to update uh
  256. 16:54the docker file that will be
  257. 17:02we need to figure out
  258. 17:05how I I I will install R and also the
  259. 17:09how to probably are but yeah I need to
  260. 17:13double check first.
  261. 17:15So um
  262. 17:19no this is not bad.
  263. 17:23So I will uh let's run a container.
  264. 17:26choice
  265. 17:31container
  266. 17:34sh
  267. 17:55Okay. Also,
  268. 17:58so I think there is a AP for APK. I
  269. 18:02think it's APK search. But uh that's the
  270. 18:05that's the thing that each operating
  271. 18:06system will have a different
  272. 18:09uh different way of searching that. So
  273. 18:13uh I think let me see if I that works.
  274. 18:21Yeah, seems that is not working on the I
  275. 18:26know what but you can also check that on
  276. 18:29Google that install R. I think the way
  277. 18:32is in uh yeah since that APK searcher
  278. 18:36for some reason is not working
  279. 18:39because this is not
  280. 18:43yeah I'm not sure what
  281. 18:50but yeah checking on uh
  282. 18:54uh
  283. 18:56if I search on Google how to install R
  284. 18:59on Alpine It would tell me that this APK
  285. 19:03other R that will be
  286. 19:07warning opening.
  287. 19:09Yeah, I need to check why it's not uh
  288. 19:12because if I do a APK search,
  289. 19:16it's not uh working.
  290. 19:20Oh, well, okay. a APK search will list
  291. 19:24you all packages that are but yeah that
  292. 19:27would be a bit of a
  293. 19:32so if I do
  294. 19:35ah okay apk
  295. 19:39ak
  296. 19:41search this is to find a
  297. 19:46uh actually I don't know if that is
  298. 19:50APK
  299. 19:56help.
  300. 19:58Okay. Fine.
  301. 20:01So here I can get the some help
  302. 20:06in pattern the bracket is and I think
  303. 20:08the minus E
  304. 20:11is not here.
  305. 20:21Oh yeah, match pack package names
  306. 20:23exactly
  307. 20:26of for search to a pattern in the
  308. 20:29description.
  309. 20:31Yeah, there are different options. So
  310. 20:33the option that uh I use it worked is AP
  311. 20:37search minus er
  312. 20:40and that tells you tells you the the
  313. 20:43package and the version that I will use
  314. 20:45that is the 4.6.
  315. 20:48So now we know that to install R is APK
  316. 20:52R
  317. 20:53that I guess yeah it's okay it's already
  318. 20:56installed
  319. 21:01and but yeah I it's a bit uh yeah bit uh
  320. 21:05I mean tricky depending on the operating
  321. 21:08system you will find different ways of
  322. 21:10uh so that's why I recommend like before
  323. 21:12building to do this in an interactive
  324. 21:15way to know power and to check the
  325. 21:19version of R. I think it's an R minus
  326. 21:22minus version. Let's see if that works.
  327. 21:26I print
  328. 21:28the version. Yeah, it works. So now that
  329. 21:31we know how to uh
  330. 21:35the commands that we need to run, I will
  331. 21:37use edit uh docker file.
  332. 21:43So I will uh do replace this
  333. 21:48use R and here in Python I will use R
  334. 21:51version.
  335. 21:54Oops.
  336. 21:56Okay. The way to is
  337. 22:02Oh, okay. I'm doing something is alt f
  338. 22:13x.
  339. 22:16Okay. So uh now to build the it will be
  340. 22:21mal image build
  341. 22:27minus t and docker.io IO
  342. 22:32a username
  343. 22:34and this will be
  344. 22:38R
  345. 22:42and where where the docker file is is
  346. 22:45that is this here
  347. 22:52okay we cannot use upper case
  348. 22:55so what applying R in a lower case
  349. 22:59Sometimes when we get an error is good I
  350. 23:01mean good
  351. 23:05sometimes if it's a wrong error is
  352. 23:07something that is we could turn to okay
  353. 23:10what is that what is happening to panic
  354. 23:13let's say but uh some in some some cases
  355. 23:17or well we see most of the cases but
  356. 23:19yeah sometimes it's not the the case
  357. 23:22that reading the the solution is ling
  358. 23:25the error message so here you get error
  359. 23:29that the tag docker io invalid reference
  360. 23:32format repository name must must be
  361. 23:35lower case. So I change it and yeah see
  362. 23:39if that works
  363. 23:47and yeah it works. Now do podman
  364. 23:52uh image uh ls
  365. 23:56and yeah I have now alpine r and alpine
  366. 24:00python.
  367. 24:03So if I run pol container run
  368. 24:12yeah it will show the
  369. 24:15so this is the way of uh creating an
  370. 24:17image once that we are happy with the
  371. 24:20image and we test the image and we see
  372. 24:22that everything work etc what I can do
  373. 24:26is I can upload that image to docker
  374. 24:30let's see because this might work or or
  375. 24:34not.
  376. 24:36Uh we'll um
  377. 24:42uh we'll see how to do that. Uh
  378. 24:46well actually yeah the command is easy
  379. 24:49but yeah if you get any errors let me
  380. 24:53know. So this will be pm
  381. 24:56image push
  382. 24:58and the well this will be docker.io
  383. 25:04and username
  384. 25:06and I will use a pi. Python I can upload
  385. 25:11the other one but
  386. 25:14so if I do that is a creating images or
  387. 25:17signature. Um, now it's a copying the
  388. 25:22the image that has been built to a
  389. 25:25Docker hub.
  390. 25:35Takes uh some time to upload.
  391. 25:45In the meantime, I will open
  392. 25:49this one.
  393. 25:53Okay. So, yeah, now it's done. And uh I
  394. 25:58will open this one.
  395. 26:00Let's see. This will be good enough.
  396. 26:10No, you said the address is hard.
  397. 26:14docker.com
  398. 26:20I will now stop seeing
  399. 26:24s
  400. 26:26repositories.
  401. 26:34So if I type this
  402. 26:38uh copy I will paste that in the chat
  403. 26:48again. This I mean maybe not but reminds
  404. 26:52me of
  405. 26:55a bit of like a GitHub uh in the sense
  406. 26:59that you have like some repositories you
  407. 27:01have. So here I have my image that the
  408. 27:05last push was a minute ago. If I click
  409. 27:09here
  410. 27:11in my case for instance I don't have
  411. 27:15eco. This is like just an example and I
  412. 27:19I would try to make this.
  413. 27:26I can add here a description that
  414. 27:29yeah doesn't show so well
  415. 27:32or add a category of uh
  416. 27:36and say
  417. 27:38for instance language and frameworks for
  418. 27:40in
  419. 27:44so I have a category here description is
  420. 27:46uh
  421. 27:48I can say I'll
  422. 27:51find
  423. 27:56Python install
  424. 28:04and what the tag that I have here is the
  425. 28:06latest the operating system is yeah
  426. 28:08Linux image that's
  427. 28:12I can also add an overview
  428. 28:15that this is yeah this is this
  429. 28:17incomplete and this will be like a kind
  430. 28:19of the red me of
  431. 28:23I can check the tax.
  432. 28:29I don't know what is image management.
  433. 28:37Aware this is like are the previous
  434. 28:39versions of this uh image
  435. 28:43collaborator. I can add some people that
  436. 28:46will give be given push and pull access
  437. 28:48to the repository. But what a repository
  438. 28:51is public. So everyone can have access
  439. 28:53to the
  440. 28:58I can do a static scanning. Yeah, they
  441. 29:02have like some options here also. I can
  442. 29:04archive the repository or delete the
  443. 29:06repository that the repositories that
  444. 29:09were my username and the name of the
  445. 29:12image.
  446. 29:14Um yeah what the public view if I click
  447. 29:16here this will be the public view of the
  448. 29:21yeah doesn't have any overview but yeah
  449. 29:23I have here that is like a language and
  450. 29:25frameworks and the description here
  451. 29:29tags
  452. 29:34I think if I click here
  453. 29:38yeah is it's possible to see the
  454. 29:44the layers each layer is like the
  455. 29:46commands that we have.
  456. 29:49So this is to install Python. Yeah, the
  457. 29:52cmd.
  458. 29:59Okay. So now we know how to create a
  459. 30:02image uh how to upload it to the if
  460. 30:05someone wants to use this uh image uh
  461. 30:08the only need that they need to do is
  462. 30:15to do that what will be pm image pool uh
  463. 30:20one frcker.io
  464. 30:25IO that this is there
  465. 30:28and we see I don't know
  466. 30:31how what this uh image has been
  467. 30:34downloaded 351 times
  468. 30:38not sure who who wanted to use it but
  469. 30:42and has been star zero times that that
  470. 30:46makes more sense but this is a
  471. 30:51if I click here yeah if to my profile
  472. 30:55file community user repositories. Yeah,
  473. 30:57I have like a one repository
  474. 31:01that was updated a few minutes ago.
  475. 31:08I think that's it. Let me check if I
  476. 31:11missing something. Uh
  477. 31:14well, some uh general advice on how to
  478. 31:17build a image.
  479. 31:20Uh
  480. 31:24the idea here is also not to kind of
  481. 31:27reinventing the wheel or check if uh we
  482. 31:30have already on the docker repository an
  483. 31:33image that features Python, I will use
  484. 31:37that image rather than creating uh my
  485. 31:39own unless that for some reason I want
  486. 31:44something very specific on the image
  487. 31:46that is not there. But rather than
  488. 31:49starting with Alpine, I will start with
  489. 31:52the Python Alpine. Now I will not uh
  490. 31:57let's say create something that already
  491. 32:00assist.
  492. 32:02It's important as well to check the
  493. 32:04which uh operating system which Linux
  494. 32:08flavor I want to use. Here I'm using
  495. 32:11Alpine because uh let's say that it
  496. 32:13works.
  497. 32:16is good because it doesn't take that
  498. 32:18much space but uh you could find the
  499. 32:20case that uh you will need wu or deavian
  500. 32:24to uh don't know maybe your sho has some
  501. 32:29dependencies that are only available in
  502. 32:32deavian let's deviant let's say so you
  503. 32:35can use that one uh also check that
  504. 32:38don't install things that you will not
  505. 32:41need I mean on an image you can install
  506. 32:44python r you can install other
  507. 32:47programming languages. But if you only
  508. 32:50need Python, just yeah, keep uh that um
  509. 32:58um I think that's the
  510. 33:03yeah that's it. So kind of the procedure
  511. 33:05is that what we have seen uh to test
  512. 33:08that inter in an interactive way to see
  513. 33:11that the commands work and then write
  514. 33:17the docker file build it and if you want
  515. 33:20you can upload it and you will have it
  516. 33:23on your on the docker repository.
  517. 33:28if you have a any questions.
  518. 33:34If not, we can continue. Let me see
  519. 33:42that I'm not forgetting anything.
  520. 33:54Okay. So uh stop
  521. 33:58again my
  522. 34:00terminal
  523. 34:19actually that's yeah
  524. 34:21I would say it's an important question
  525. 34:24to have like uh when because yeah okay
  526. 34:27that's a let me sure
  527. 34:33and that's something that we should be
  528. 34:34careful when we uh go to a when we use
  529. 34:38an image okay and here let's go to
  530. 34:42explore so uh I said that well the
  531. 34:46question is about I want to use python
  532. 34:48but uh uh how do I know that the let's
  533. 34:53say an image with python is this is the
  534. 34:56right one is good. So when I search here
  535. 34:59I have a Python
  536. 35:05did I search?
  537. 35:15Oh well okay here you see explore
  538. 35:19official im images images images and
  539. 35:21python you should look for the docker
  540. 35:24official image that mean that means that
  541. 35:28is uh has been let's say per review or
  542. 35:31is what per review that yeah that is um
  543. 35:37yes an official image so uh
  544. 35:41and is maintained by the docker
  545. 35:42community and but you have here So uh
  546. 35:47also another uh good uh is there like
  547. 35:50the number of do you see that this image
  548. 35:53this week has been uh download
  549. 35:5821 million times.
  550. 36:02So for instance, this uh image makes
  551. 36:05sense that looks uh
  552. 36:08I mean I will I will use this one or for
  553. 36:10instance one that they have a verified
  554. 36:12publisher
  555. 36:14could be the case that for some reason
  556. 36:16you download an image that is from that
  557. 36:20maybe don't have this uh uh docker
  558. 36:22official image or it's like a maybe less
  559. 36:26u difficult but you can find that uh I
  560. 36:31could find later an example But uh again
  561. 36:34when you when you read a paper on for
  562. 36:37instance when you use uh uh these
  563. 36:41containers and images are quite uh used
  564. 36:43in uh machine learning deep learning
  565. 36:47when when you uh run a model. So uh
  566. 36:52most of the models they provide a
  567. 36:55container and uh you should check for
  568. 36:59instance that the the the
  569. 37:03name match with the author. So this kind
  570. 37:06of a bit well common sense. Yeah that
  571. 37:09are like some ways to uh check.
  572. 37:12I'm trying to see how can I search here
  573. 37:18because I type Python.
  574. 37:22Ah, see our search result. So I search
  575. 37:25for Python
  576. 37:27but probably well you see that this is
  577. 37:29sorted by the official image uh sponsor
  578. 37:35or open software.
  579. 37:38But here for insta
  580. 37:51well they have like a 1 million loss but
  581. 37:54for instance this one is uh what
  582. 37:57repositive for Python jobs
  583. 38:00that was last updated.
  584. 38:02Well, they have a few, but for instance,
  585. 38:06this one, you don't know what is uh
  586. 38:12well, okay, they have a website
  587. 38:17look. So, that's the thing that you need
  588. 38:19to be care because you are looking for
  589. 38:21Python and maybe you have like a plenty
  590. 38:24of
  591. 38:26images here that uh but maybe you
  592. 38:28download something that is not what
  593. 38:30you're looking for.
  594. 38:36So for instance this one the docker
  595. 38:38official image that gives you like some
  596. 38:41certainty that is not sure that
  597. 38:44your question also for instance we were
  598. 38:47searching before for r
  599. 38:51our base bas is the
  600. 38:53here again we have is a docker official
  601. 38:55image or uh
  602. 39:00I think was pytor watch
  603. 39:04that is quite useful.
  604. 39:13Oh well, actually this one is hard.
  605. 39:18Well, if I manage to type it well,
  606. 39:37you see for instance a Pytho that is
  607. 39:39like a
  608. 39:41doesn't have this but it's like a
  609. 39:45have been downloaded more than 10
  610. 39:47million times. uh tags. So
  611. 39:51for instance, if I want to use PyTorch,
  612. 39:53so yeah, I could have a look at this one
  613. 39:55that we have a
  614. 39:59since that is a reliable you have all of
  615. 40:01these tags that uh what this is for
  616. 40:04CUDA.
  617. 40:06I want you see this image is 8.6 GB.
  618. 40:12So yeah, Py torto is quite of a big uh
  619. 40:16and also I think provides the tens or no
  620. 40:20for you see that this image for instance
  621. 40:22is quite big is 8.6 six.
  622. 40:25But what this is like for PyTorch. So in
  623. 40:28if I want to use run PyTorch, I will
  624. 40:31download this image. I will not deal the
  625. 40:34uh with CUDA. I will I will need to
  626. 40:36check the right version. But if it's
  627. 40:39already here,
  628. 40:45this seems that it's like a kind of
  629. 40:48reliable
  630. 40:56Yeah.
  631. 40:58Okay. So, yeah, this is like a regarding
  632. 41:01the So, what I will uh do now is because
  633. 41:05we have seen how to create a container.
  634. 41:08But what about if I want to uh
  635. 41:15use a file that is or like a use a files
  636. 41:18that are on my uh on my laptop. Let's uh
  637. 41:22for instance because now we have Python
  638. 41:24but I want to run a script in uh that is
  639. 41:27in my laptop that use a Python without
  640. 41:30installing it. So let's uh see how we
  641. 41:33can do that. Uh
  642. 41:43Okay. So we are here and uh if we go to
  643. 41:47the
  644. 41:50to this repos
  645. 41:53folder one uh directory back if I do I
  646. 41:58see that I have a folder that is called
  647. 42:01s
  648. 42:03and here I have a docker what docker
  649. 42:05file and this we have also this uh
  650. 42:09python script this editor somewhere I
  651. 42:13and have a look and see
  652. 42:17the Python script what it does.
  653. 42:21Uh, let me see if I can exit.
  654. 42:27I think I I don't think that they have
  655. 42:29Python here installed on. No, I don't
  656. 42:32have Python installed.
  657. 42:34Python 3. No, it's not working either.
  658. 42:39uh
  659. 42:43what it does is uh we can provide
  660. 42:47several numbers and we can get the
  661. 42:49addition of these uh numbers but because
  662. 42:52I don't have Python on my machine I will
  663. 42:55uh I will try to I can use my the
  664. 43:00uh the container the the image that I
  665. 43:04have created and run this uh file file
  666. 43:08or you yeah run this file. So this will
  667. 43:11be p
  668. 43:13container
  669. 43:17run the name that will be I will use the
  670. 43:21shorter one
  671. 43:24I python
  672. 43:26and I can use python 3.
  673. 43:34If I use that I will get an error here.
  674. 43:37So uh yeah Python 3 works but they will
  675. 43:41say they can't open file that not not
  676. 43:44such a file of directory.
  677. 43:48This is because uh
  678. 43:51if you remember the well you remember
  679. 43:55the
  680. 43:56the file system on the
  681. 44:00on the container is different of the
  682. 44:03file system that I have on my uh on my
  683. 44:07laptop. So if um we do this, if we do ls
  684. 44:11here,
  685. 44:17you will see all of these. You will see
  686. 44:20that the
  687. 44:25on the container you have all of these
  688. 44:27uh directories. But if I do ls on my
  689. 44:31laptop, I have like a different uh
  690. 44:34output.
  691. 44:36I have this uh output here because five
  692. 44:39systems are different.
  693. 44:42Uh one way to uh to uh solve that issue
  694. 44:50is I I will need it to mount
  695. 44:53this directory
  696. 44:56on the on the container and uh it will
  697. 44:59uh run.
  698. 45:02What is uh the way to do that? This will
  699. 45:04work complicated. This will uh yeah be
  700. 45:07the command will be a little bit longer.
  701. 45:09So that will be this will be o mount
  702. 45:13container run and here I will need to
  703. 45:16use the option mount
  704. 45:20mount has a three different uh parts. So
  705. 45:25they have a type
  706. 45:29equal we will use in in this lesson uh
  707. 45:33bind that are two two other types but uh
  708. 45:38we are not well we we don't need them we
  709. 45:40are not covering in this lesson. So
  710. 45:43remember that uh to mount we would use
  711. 45:46type will be pine
  712. 45:49uh source
  713. 45:52that uh we can specify the
  714. 45:58we have an environment variable that is
  715. 46:00pwd that is like a
  716. 46:04personal personal working directory is
  717. 46:06the the directory where I am. So uh this
  718. 46:10should work like this
  719. 46:13also you see that that change of color
  720. 46:16this because it's a
  721. 46:18uh environment environment variable
  722. 46:22comma and the third part will be uh the
  723. 46:27target where this will be mount. So this
  724. 46:30will be mounting slash 10.
  725. 46:37Now the name of the m the image alpine
  726. 46:41alpine python
  727. 46:44and again python 3
  728. 46:49sound py
  729. 46:53but uh as you can imagine this fails
  730. 46:57again because uh notice that I executed
  731. 47:01this file but this file again is not in
  732. 47:04uh
  733. 47:11is not there is in a is in a SL tag. So
  734. 47:15if I do that
  735. 47:20you will see let's go step by step mount
  736. 47:24container run this is what I have added
  737. 47:29on the alpine python and the ls
  738. 47:3310
  739. 47:35you see so just to
  740. 47:40I will need to do 10
  741. 47:44if I And this
  742. 47:47this must work well the
  743. 47:51it's a zero but I can add 11 12 or 13 15
  744. 47:59and now now it works
  745. 48:03but uh I will need to specify all of all
  746. 48:07of these auto continue well all of these
  747. 48:10mount
  748. 48:11the source that will be made My current
  749. 48:15def
  750. 48:20is this. So this directory will be in /
  751. 48:2510
  752. 48:27and then I can execute Python 3 or where
  753. 48:30the repository is.
  754. 48:38Is that uh
  755. 48:42yeah hopefully it's well clear is I know
  756. 48:45that yeah that makes things a bit uh
  757. 48:48yeah longer but this is the way of
  758. 48:51mounting a repository that uh sorry
  759. 48:55repository
  760. 48:56a directory that I have in my laptop on
  761. 49:00the on the container
  762. 49:09Uh
  763. 49:15I've done before ls. This is like a
  764. 49:18command that maybe you may find useful
  765. 49:21on my container.
  766. 49:30Uh
  767. 49:32pine python
  768. 49:42well actually no let's use let's use the
  769. 49:45previous we have executed this
  770. 49:50so here if I do ls
  771. 49:56you will see that the listing by default
  772. 49:58goes to uh to uh uh root
  773. 50:03but uh
  774. 50:09I can specify minus w that this will be
  775. 50:13the
  776. 50:15this will be my let's see the working
  777. 50:17directory the current directory on the
  778. 50:19container so here I can specify last
  779. 50:21time for instance
  780. 50:24and if I do ls
  781. 50:27Now
  782. 50:29you see that now I'm in the SL 10
  783. 50:34because I've added this uh the working
  784. 50:37directory will be SL 10.
  785. 50:44Another option that uh may be useful is
  786. 50:47to specify the username. I said before
  787. 50:49that uh we have a a
  788. 50:57man root.
  789. 51:00Uh but I can
  790. 51:03use the following. So I can
  791. 51:06say
  792. 51:09minus u um choose the username. I mean I
  793. 51:13will choose the same username. For
  794. 51:15instance, my machine is a Jig 6.
  795. 51:20So if you skip that
  796. 51:25Oh, that will uh
  797. 51:32Yeah, that will uh fail because it's not
  798. 51:36in the
  799. 51:38Yeah, we will be needed to use a Yeah.
  800. 51:42Okay, that case is not
  801. 51:48okay. So there is a question that
  802. 51:55okay I the the
  803. 51:59minus w is to specify the working
  804. 52:01directory of uh so um
  805. 52:07let's go
  806. 52:10let's forget about this amount
  807. 52:21So here if I do so or let's say pwd
  808. 52:26you see that I'm in uh let's see the
  809. 52:28working directory of the contain of the
  810. 52:30container is uh root but I can specify
  811. 52:35here
  812. 52:39uh minus w for as I can say that this
  813. 52:42will be uh
  814. 52:45I can specify that will be in this
  815. 52:48directory.
  816. 52:50So now if I execute the container you
  817. 52:54will see that now I'm in that uh
  818. 52:56directory rather than so what you
  819. 52:59specify with the minus w is the
  820. 53:03directory that uh the container will uh
  821. 53:06when you run the container the direct
  822. 53:08the direct directory that it will be you
  823. 53:11can also specify /tmp
  824. 53:16media empty
  825. 53:19exactly Yeah. Yeah. Enters the container
  826. 53:23in the specified working directory.
  827. 53:27The thing if I do here I can use TMP.
  828. 53:34Now will be
  829. 53:39you see that in this case for instance a
  830. 53:41tmp now what we have used before
  831. 53:46it is oh no it's mountains last time
  832. 53:59we can also get this error uh preparing
  833. 54:02container error the work DS system does
  834. 54:06not does not exist. So it will fail. For
  835. 54:08instance, if we choose a directory that
  836. 54:10is not uh there before it was working
  837. 54:14because we were creating a new with
  838. 54:17mount we were creating the new uh
  839. 54:20directory. This is one option that yeah
  840. 54:23could be used or not. Uh I need to
  841. 54:27investigate.
  842. 54:28I think this the option that I have
  843. 54:30explained before
  844. 54:32the minus u I think that one works if
  845. 54:36the if we are using uh maybe Linux or
  846. 54:41Mac rather than
  847. 54:44uh Windows in Windows it seems that this
  848. 54:46this is not working. I can check it
  849. 54:50actually the documentation will be
  850. 54:54container.
  851. 55:02[snorts] These are all the options that
  852. 55:04we have. Maybe that is a
  853. 55:19username of
  854. 55:24Yeah, that was failing before
  855. 55:29because I think it only works on uh
  856. 55:31maybe when you're on Linux or
  857. 55:34I need to investigate that.
  858. 55:51Okay. Next. Where you see next step. Uh
  859. 55:59also one question is should I continue?
  860. 56:02Do you need a small break or you are
  861. 56:05okay
  862. 56:07to continue with the
  863. 56:10we can have a break later of yeah not
  864. 56:16sure if you needed five minutes or
  865. 56:36Is that okay? salary. Continue with the
  866. 56:44Okay, let me Well, let me check what I
  867. 56:53Well, let's continue with this and uh we
  868. 56:55can see later maybe because it's
  869. 57:00Yeah, let's continue. is that we can
  870. 57:02have like a a quick break [laughter]
  871. 57:04later but please if you need a break
  872. 57:07just to say that in the chat and I happy
  873. 57:09to stop for five 10 minutes or what the
  874. 57:12time that you need. Uh
  875. 57:17okay. So uh we were talking about um
  876. 57:25what we have seen
  877. 57:28yeah to use the because we have a image
  878. 57:31that has Python and we have a script a
  879. 57:34script but we can make the and actually
  880. 57:37that's the maybe the idea of the
  881. 57:40what container of to we can the image we
  882. 57:44can include that script in our uh image
  883. 57:50and uh we will not need to mount. So
  884. 57:54every time that we execute the the the
  885. 57:57image we create a container we will have
  886. 58:00the script uh there.
  887. 58:03Uh this has the advantage that uh again
  888. 58:07yeah [clears throat] you don't need a
  889. 58:08script on your laptop. disadvantage that
  890. 58:11if you update the script, every time
  891. 58:13that you update the script, you will
  892. 58:15need to create a new image. There are
  893. 58:18workarounds that could be that uh you
  894. 58:21use uh
  895. 58:23uh the image when it's built to use a
  896. 58:26GitHub.
  897. 58:30Yeah, there is a way that using a GitHub
  898. 58:32repository, but again every time that
  899. 58:35the image is built will take the the
  900. 58:39latest version of the GitHub repository.
  901. 58:42So if you update the GitHub repository,
  902. 58:45you will need to update the image as
  903. 58:48well.
  904. 58:51Okay. So uh I think the option that we
  905. 58:54have is safe. So we open
  906. 58:57this docker file.
  907. 59:04This is what we have. We can do uh we
  908. 59:07can use copy
  909. 59:10and will be the script some data py and
  910. 59:13we can copy in the /home.
  911. 59:17So if we include that when we build the
  912. 59:21image we will uh copy that script there.
  913. 59:26Let's uh
  914. 59:29see if yeah if that uh if that works.
  915. 59:37Yeah. Okay. So I need to save that. This
  916. 59:39is like a alt f say alt f exit
  917. 59:46and to build there will be both mount
  918. 59:50image
  919. 59:52build
  920. 59:54minus t
  921. 59:56and will be my use
  922. 1:00:03a username and there will be a pine
  923. 1:00:10So
  924. 1:00:12let's see and where where I am.
  925. 1:00:21You may notice here that this in the
  926. 1:00:24steps for building the I use the step
  927. 1:00:26104 from Alpine fine. The second step
  928. 1:00:31you will notice that is using cache
  929. 1:00:34because we have already
  930. 1:00:37built the
  931. 1:00:40we have already done that previously.
  932. 1:00:42This is cash. So this will not run
  933. 1:00:45again.
  934. 1:00:47This part yeah this is new. So this will
  935. 1:00:50be done. And now the step four. Yeah
  936. 1:00:53done as well.
  937. 1:00:55So you see that all of the layers each
  938. 1:00:59layer is a entry of the docker or
  939. 1:01:03container file.
  940. 1:01:08So
  941. 1:01:12if I now
  942. 1:01:14what can I do?
  943. 1:01:17What do ls port
  944. 1:01:20image
  945. 1:01:23ls
  946. 1:01:28we will see that we have a some yeah
  947. 1:01:31this one we have this new
  948. 1:01:36image here
  949. 1:01:38and if I run the I will run it in an
  950. 1:01:41interactive way to bang
  951. 1:01:46contain container.
  952. 1:01:53For instance, here I can use minus
  953. 1:01:55w/home.
  954. 1:02:01Oops.
  955. 1:02:24Oh, because I forgot the sh.
  956. 1:02:28Yeah. No.
  957. 1:02:39Yeah. See a question. I'm not sure if I
  958. 1:02:40am I will fail if you try to pull the
  959. 1:02:43same image from some other directory.
  960. 1:02:48The
  961. 1:02:56the thing is when I create the when I
  962. 1:02:58build the image, this is like in
  963. 1:03:01save on the on the laptop as
  964. 1:03:05oh well uh yeah the
  965. 1:03:11yeah exactly the that
  966. 1:03:16yeah okay know what I mean the
  967. 1:03:19in the recipe at the recipe assumes that
  968. 1:03:23the that file will be in the same
  969. 1:03:26directory as the docker file. If there
  970. 1:03:29are in different directories, it will
  971. 1:03:31fail.
  972. 1:03:33So that's why when you build the image,
  973. 1:03:35you specify the directory. You don't
  974. 1:03:38specify. If you see it here
  975. 1:03:43when I build the image this is like a it
  976. 1:03:47means the current directory. So in the
  977. 1:03:50current directory I have the docker file
  978. 1:03:53and I have the python script. If the
  979. 1:03:55Python script is not here, it will fail
  980. 1:03:58this in
  981. 1:04:00or for instance, if I have a newer
  982. 1:04:02version or something, this will uh fail.
  983. 1:04:09So I'm running this
  984. 1:04:12and now if I do well, I can move to home
  985. 1:04:18and if I do ls, I have here my script.
  986. 1:04:22So I can do Python 3
  987. 1:04:28and
  988. 1:04:32I will get the
  989. 1:04:36and the option that I have tried before
  990. 1:04:41that you can say minus W home
  991. 1:04:46and you see that now rather than uh
  992. 1:04:50starting the container I'm going to to
  993. 1:04:53the to root directory I will go to /
  994. 1:04:56home directory and here I will have some
  995. 1:04:59and I will I don't know if vi will be
  996. 1:05:02available here but also I can edit the
  997. 1:05:06file if I want
  998. 1:05:12and
  999. 1:05:15an advantage of use containers for
  1000. 1:05:17instance if I oops
  1001. 1:05:20if I modify the script
  1002. 1:05:24and uh I see that for some reason
  1003. 1:05:28I don't know the the version is not
  1004. 1:05:30working or something is uh if I create a
  1005. 1:05:33new if I run the image again it will uh
  1006. 1:05:38it will uh take the the original uh the
  1007. 1:05:42original file will not contain the
  1008. 1:05:46so if I now do python
  1009. 1:05:493
  1010. 1:05:52Oops.
  1011. 1:05:57There you see that what I modify is I
  1012. 1:05:59added this.
  1013. 1:06:03But if I exit and run the container
  1014. 1:06:06again
  1015. 1:06:08and do a
  1016. 1:06:10Python
  1017. 1:06:123
  1018. 1:06:20you see that now I I I will always get
  1019. 1:06:23so this uh script will be like with a
  1020. 1:06:27container. So
  1021. 1:06:29if you publish a paper or something and
  1022. 1:06:32you include that in your uh container
  1023. 1:06:34this will be there I mean forever. The
  1024. 1:06:38this is what we are talking about the
  1025. 1:06:40make something make research or make the
  1026. 1:06:44experiments reproducible
  1027. 1:06:47that you will have there the
  1028. 1:06:50uh the script that you have used. You
  1029. 1:06:52have the environment that you have the
  1030. 1:06:54Python version that you have used.
  1031. 1:06:59You will have the script that you have
  1032. 1:07:02used that is this one. So when you
  1033. 1:07:06provide you don't provide only the when
  1034. 1:07:09you provide let's say the container you
  1035. 1:07:11don't prov you you don't provide the
  1036. 1:07:13only the script you also provide the
  1037. 1:07:16software that is uh the conditions to
  1038. 1:07:19where the script has been executed
  1039. 1:07:21because it could be the case that for
  1040. 1:07:23this version of Python
  1041. 1:07:26maybe the
  1042. 1:07:28library or something is different that
  1043. 1:07:30other versions of Python and uh the
  1044. 1:07:33resource could be different. This
  1045. 1:07:35happens a lot when again we use like in
  1046. 1:07:38deep learning, machine learning or we
  1047. 1:07:40use a cluster that has a Kubernetes.
  1048. 1:07:44uh Kubernetes what it does is you create
  1049. 1:07:47the you need to specify the container
  1050. 1:07:50the image that you want to use to run
  1051. 1:07:52the job and uh
  1052. 1:07:56yeah so that's also like one of the
  1053. 1:08:00characteristics that why uh this is a
  1054. 1:08:05containers are useful
  1055. 1:08:26Okay, that's a no.
  1056. 1:08:30This is a good point
  1057. 1:08:33if you notice here. No. Okay. Okay. That
  1058. 1:08:37that that's interesting. Then
  1059. 1:08:43yeah I will exit this container. Okay
  1060. 1:08:45that's a thank you for the questions
  1061. 1:08:47that we have docker file. If we open
  1062. 1:08:51docker file,
  1063. 1:08:56you see that I'm copying I copy the
  1064. 1:08:59script to the container.
  1065. 1:09:06And when I run the container, I run it
  1066. 1:09:08in this way. But they say this is only
  1067. 1:09:11the
  1068. 1:09:13the working directory on the container.
  1069. 1:09:15We can remove this to make things
  1070. 1:09:18easier.
  1071. 1:09:19So you don't notice here I'm I'm not uh
  1072. 1:09:23mounting anything. So uh the script
  1073. 1:09:26actually I can delete the or I can
  1074. 1:09:29rename this script and uh it will work
  1075. 1:09:33the same because the the image
  1076. 1:09:36already contains this script.
  1077. 1:09:40But if we
  1078. 1:09:42mount that script here, let's see if I
  1079. 1:09:47find the
  1080. 1:09:54I do the little of this to make things
  1081. 1:09:56easier.
  1082. 1:09:58My container run. You see that I
  1083. 1:10:01mounting the the the folder here.
  1084. 1:10:06I will need to do minus 80.
  1085. 1:10:12So here if I go to SL
  1086. 1:10:16I can modify the script here and if I
  1087. 1:10:20modify the script
  1088. 1:10:24it will uh the changes will be when the
  1089. 1:10:27container stops the changes will remain
  1090. 1:10:31because I modifying the file on the
  1091. 1:10:40Exactly. So yeah that that's the point
  1092. 1:10:43that if I mount the directory that is in
  1093. 1:10:47my laptop on the container the
  1094. 1:10:50modifications will remain but if I
  1095. 1:10:53modify something on the that that this
  1096. 1:10:56is like one of the advantages of the
  1097. 1:10:59uh containers and that's why we are
  1098. 1:11:02mentioning that we have a the image and
  1099. 1:11:04we have a like from one image we can
  1100. 1:11:07create
  1101. 1:11:09different copies let's
  1102. 1:11:11will be different containers. So let's
  1103. 1:11:14do here the sample. If I modify this
  1104. 1:11:16here
  1105. 1:11:21and now I exit
  1106. 1:11:24if I I'm not sure if cut will work here.
  1107. 1:11:28You see that the that this has been
  1108. 1:11:30modified and actually the last time last
  1109. 1:11:34right time is now it's uh 21 past uh 2.
  1110. 1:11:40for 20 2021 past two.
  1111. 1:11:45So this is also something that you need
  1112. 1:11:47to yeah be be careful that yeah that
  1113. 1:11:51so yeah it's a bit yeah I mean makes
  1114. 1:11:53sense the I think was a bit yeah I mean
  1115. 1:11:56confusing yeah
  1116. 1:11:59I think I explain like at the same time
  1117. 1:12:02the one thing is mount that is like a
  1118. 1:12:05one further of the because so far not uh
  1119. 1:12:11if we run the container itself the it
  1120. 1:12:15will preserve or will not do any changes
  1121. 1:12:18to the erh files that are in the laptop.
  1122. 1:12:22But at the moment that they mount a
  1123. 1:12:25directory from the laptop this will this
  1124. 1:12:28can suffer changes or if we create new
  1125. 1:12:32files this will for instance we are
  1126. 1:12:35using a container or yeah we are running
  1127. 1:12:38a container to create uh some data files
  1128. 1:12:41or to create a plot or to
  1129. 1:12:45uh even for latt to uh generate a PDF
  1130. 1:12:49out of tech file.
  1131. 1:12:52Uh we can use a container and uh mount
  1132. 1:12:57one of the forces of that uh of that uh
  1133. 1:13:01of the laptop.
  1134. 1:13:07Let me see if I'm forgetting something.
  1135. 1:13:18Okay, I haven't explained that.
  1136. 1:13:21I will
  1137. 1:13:30scroll here.
  1138. 1:13:35You remember when we have a compile this
  1139. 1:13:38uh
  1140. 1:13:41uh yeah this part
  1141. 1:13:46you see that for this uh run up ak and
  1142. 1:13:50then I added a copy you see that here
  1143. 1:13:52they said using cash so it's not running
  1144. 1:13:55this uh is not executing this this layer
  1145. 1:13:58again
  1146. 1:14:01this will be different if we
  1147. 1:14:08If uh we put the copy here in instead
  1148. 1:14:22will make things you see that the
  1149. 1:14:24container is the uh
  1150. 1:14:28same I mean the same recipe let's say
  1151. 1:14:30the order is different but I will not
  1152. 1:14:32make any let's see changes but when we
  1153. 1:14:36uh compile the
  1154. 1:14:39oh this is
  1155. 1:14:42I don't know if I do exit okay they will
  1156. 1:14:45ask me to say yeah fine if now I do
  1157. 1:14:51image build
  1158. 1:14:57again docker io
  1159. 1:15:00my username
  1160. 1:15:08If I do this now, you will see. Well,
  1161. 1:15:11let's see if
  1162. 1:15:18you see that it's no longer using the
  1163. 1:15:20cash because the the the order is uh uh
  1164. 1:15:25different. So it is important that when
  1165. 1:15:29you do some uh by it's recommended
  1166. 1:15:34that uh let's see to keep this in order
  1167. 1:15:37if you do a modification do it on top of
  1168. 1:15:40so it's like a one layer is a built on
  1169. 1:15:44top of the previous ones. So at the
  1170. 1:15:46moment that you change the order of the
  1171. 1:15:48layers it will uh I mean be less
  1172. 1:15:52efficient because it will run this step
  1173. 1:15:54again. Let's say this is a
  1174. 1:15:58tiny sample so it's not a big deal but
  1175. 1:16:01if uh
  1176. 1:16:03uh we are building like a larger
  1177. 1:16:06container and that will make things and
  1178. 1:16:10I think it's a
  1179. 1:16:14I don't remember I think there are like
  1180. 1:16:16some uh guidance uh to use like the when
  1181. 1:16:20we open the
  1182. 1:16:24there are some guidance saying that uh
  1183. 1:16:27well it depends like a copy must be at
  1184. 1:16:29the
  1185. 1:16:33I mean try to do like a as much as
  1186. 1:16:36possible like to build on top of layers
  1187. 1:16:38that you have already used
  1188. 1:16:43because otherwise if you change the
  1189. 1:16:45order
  1190. 1:16:47uh yeah that uh the previous layer will
  1191. 1:16:52be like wrong again. I mean build again.
  1192. 1:16:56I think
  1193. 1:17:01something I think this
  1194. 1:17:05exit say. Yeah, that's to keep the
  1195. 1:17:08original.
  1196. 1:17:24Okay. So, uh
  1197. 1:17:29maybe we can have a quick uh
  1198. 1:17:33break.
  1199. 1:17:37[clears throat]
  1200. 1:17:38Well, any questions before
  1201. 1:17:43I just trying to
  1202. 1:17:50I want this is interesting this part.
  1203. 1:18:00Okay. So maybe we can have a it's a 15
  1204. 1:18:03minute break. Okay. And we'll be back at
  1205. 1:18:06uh quarter 2 three. I think for the the
  1206. 1:18:10lesson well we need to like explain some
  1207. 1:18:12other things but I I I think that we can
  1208. 1:18:16finish like uh uh we will not we can
  1209. 1:18:19finish before four.
  1210. 1:18:23So uh maybe we can have a yeah
  1211. 1:18:28like a 15 minute break and be back at
  1212. 1:18:31quarter 2 three and finish the lesson.
  1213. 1:18:34Maybe the the remaining will be maybe
  1214. 1:18:37half an hour or so. Is that uh okay?
  1215. 1:18:42>> Yeah. All good.
  1216. 1:18:44>> Good. Thank you. So I will uh Yeah. So
  1217. 1:18:48we'll be back. I will write that.
  1218. 1:18:59Yeah. So, this will be the new time.
  1219. 1:19:01Yeah. I will share the again the
  1220. 1:19:03counter. Yeah. See you in a bit. Again,
  1221. 1:19:06if you have any questions or any
  1222. 1:19:07comments, put them in the chat. I can
  1223. 1:19:10solve them after the break. See you in a
  1224. 1:19:13in a bit.
  1225. 1:19:22Okay. So, uh let's uh continue. I
  1226. 1:19:25noticed that I put a large break about
  1227. 1:19:27that afternoon break, but it's
  1228. 1:19:32okay. So uh what we will see now is uh
  1229. 1:19:37keep working with well the containers
  1230. 1:19:40how to make them uh because we have seen
  1231. 1:19:43that uh how to build a container and how
  1232. 1:19:45to include a script. So there are other
  1233. 1:19:49ways that we can run the script on the
  1234. 1:19:52container. So we will see them and uh we
  1235. 1:19:56will see a little bit of part theory
  1236. 1:19:59about the containers. Also there is a
  1237. 1:20:02interesting uh article that explains the
  1238. 1:20:05like the
  1239. 1:20:07uh 10 points that you should have a look
  1240. 1:20:11for
  1241. 1:20:12um
  1242. 1:20:15you should take into account when
  1243. 1:20:17building a a container. Um yeah, that
  1244. 1:20:21will be uh us for uh for today and we
  1245. 1:20:25will be ready for uh Wednesday because
  1246. 1:20:27on Wednesday we will work on archer 2
  1247. 1:20:29and we will see
  1248. 1:20:32uh how to use uh containers on a let's
  1249. 1:20:36see on a superco computer or in a
  1250. 1:20:38different uh uh computer that is not us
  1251. 1:20:43and we will use a singularity for that.
  1252. 1:20:49Okay. So uh I'll
  1253. 1:20:53yeah share my time
  1254. 1:21:00uh let me okay so what we have what we
  1255. 1:21:04have done is we have included let's
  1256. 1:21:11yeah we have included uh the script uh
  1257. 1:21:14here fine
  1258. 1:21:17uh there are two But I will there are
  1259. 1:21:21two options
  1260. 1:21:23uh because what we are doing if we want
  1261. 1:21:26to use the script
  1262. 1:21:30okay we have the script there. So one of
  1263. 1:21:32the options will be
  1264. 1:21:35um
  1265. 1:21:40yeah so this will be podma
  1266. 1:21:44container
  1267. 1:21:46run align
  1268. 1:21:50iPhone.
  1269. 1:22:01No, it's uh home
  1270. 1:22:06dy
  1271. 1:22:08will be 10
  1272. 1:22:1020
  1273. 1:22:13H.
  1274. 1:22:15Oh, because it's not alpine Python. is
  1275. 1:22:17alpine. So, so I'm using the wrong
  1276. 1:22:21image.
  1277. 1:22:25Okay. So, this is one option that we
  1278. 1:22:27have to run the container. So, podman
  1279. 1:22:31container run the image and then I need
  1280. 1:22:34to remember
  1281. 1:22:37to execute Python 3 where the script is
  1282. 1:22:40and the
  1283. 1:22:43so one of the what we can do is we can
  1284. 1:22:46include the that
  1285. 1:22:50we can include that on the
  1286. 1:22:55on the command that is always used and
  1287. 1:22:58see Oh that uh so if I do edit docker
  1288. 1:23:02file
  1289. 1:23:05here rather than python 3 minus minus
  1290. 1:23:07version I can use uh /home
  1291. 1:23:13py
  1292. 1:23:18and the the numbers will be uh okay so
  1293. 1:23:21let's do that
  1294. 1:23:25exit save
  1295. 1:23:27so we'll be now OM
  1296. 1:23:31uh no will be image build
  1297. 1:23:41this will be docker do IO
  1298. 1:23:48I
  1299. 1:23:50s
  1300. 1:23:52I can specify for instance a version
  1301. 1:23:54version one I can I will choose that tag
  1302. 1:23:58and
  1303. 1:24:00and the directory.
  1304. 1:24:04So this cast
  1305. 1:24:07okay so now we I have this and I will
  1306. 1:24:09try.
  1307. 1:24:12So I don't specify this.
  1308. 1:24:16I specify the version version one.
  1309. 1:24:20But uh if I execute this uh this will
  1310. 1:24:25not be taken as uh the arguments of the
  1311. 1:24:29uh
  1312. 1:24:31the 1020 will be considered as a
  1313. 1:24:34command. That's why the they said
  1314. 1:24:37executable file 10 not found in path. So
  1315. 1:24:41we need to do uh something else and
  1316. 1:24:43actually we will learn something new
  1317. 1:24:45here
  1318. 1:24:48that what we are learning is we need to
  1319. 1:24:50use u
  1320. 1:24:53we will use what is called an entry
  1321. 1:24:57entry point.
  1322. 1:25:00So uh when we type something on the when
  1323. 1:25:04we run the container this will consider
  1324. 1:25:06arguments rather than
  1325. 1:25:10uh rather than the
  1326. 1:25:14I will say it one day uh
  1327. 1:25:20yeah arguments rather than a command. Uh
  1328. 1:25:25so
  1329. 1:25:27this yeah so what I need to change here
  1330. 1:25:31and as I said is important to add if we
  1331. 1:25:35can to add some comments. So we can do a
  1332. 1:25:39rung
  1333. 1:25:47for instance something like that. Uh so
  1334. 1:25:51the new entry that we will use is entry
  1335. 1:25:55point.
  1336. 1:25:57Actually I can
  1337. 1:26:02use entry point.
  1338. 1:26:09So if I use that
  1339. 1:26:11this will be the now when when I type
  1340. 1:26:15something on the when I execute the
  1341. 1:26:16container this will be taking as
  1342. 1:26:19arguments rather than the uh a command.
  1343. 1:26:26I will uh give a default argument
  1344. 1:26:36and I will use cmd.
  1345. 1:26:40Uh you can specify for instance a zero
  1346. 1:26:47zero for instance. See if that
  1347. 1:26:52uh
  1348. 1:26:58okay I think this must work. So I will
  1349. 1:27:01uh
  1350. 1:27:04save.
  1351. 1:27:09So just to show you the the the change
  1352. 1:27:13that we have done is that we are using
  1353. 1:27:15entry point rather than the cmd.
  1354. 1:27:19So if we do that uh let's build the
  1355. 1:27:22container. So uh for image B time
  1356. 1:27:47yeah well let's use let's keep the
  1357. 1:27:50version one because the previous one was
  1358. 1:27:52not working.
  1359. 1:27:57And now we can see
  1360. 1:28:13Yeah, now you see that it work. So this
  1361. 1:28:16would be like a maybe a more elegant way
  1362. 1:28:18to uh provide the container because in
  1363. 1:28:21that case you see that we not we don't
  1364. 1:28:24need to specify Python 3. We don't need
  1365. 1:28:26to specify the name of the cont the the
  1366. 1:28:28name of the script. So that will be a
  1367. 1:28:33an elegant uh way. What if for instance
  1368. 1:28:37because in this case I have a shift any
  1369. 1:28:41questions
  1370. 1:28:43so far? If not I can proceed and explain
  1371. 1:28:47the let's see the other way to make this
  1372. 1:28:50uh the squid like a more uh
  1373. 1:28:55eleant.
  1374. 1:29:05Yeah.
  1375. 1:29:10So this is one way. Another way that for
  1376. 1:29:13instance if imagine that rather than one
  1377. 1:29:15script we have a several scripts. We
  1378. 1:29:18have a sum, we have a multiply, we have
  1379. 1:29:21a
  1380. 1:29:25uh
  1381. 1:29:28that that would be gooder to specify the
  1382. 1:29:32the script that I want to run on. uh on
  1383. 1:29:36the
  1384. 1:29:39on the container. So, one of the ways
  1385. 1:29:42that I can do is uh
  1386. 1:29:48yeah, let's edit that. Uh
  1387. 1:29:53oops.
  1388. 1:29:56I know because I don't have the user
  1389. 1:29:58edit.
  1390. 1:30:05So well this is like one of the
  1391. 1:30:07solutions that we but another solution I
  1392. 1:30:11will delete that here.
  1393. 1:30:16Another solution that I can do is uh I
  1394. 1:30:19can uh do uh
  1395. 1:30:22change the the permissions of the
  1396. 1:30:25script.
  1397. 1:30:32So I will make this script will be a
  1398. 1:30:36executable. So I will not need Python to
  1399. 1:30:40execute it using Python 3 s. So we will
  1400. 1:30:43run iter
  1401. 1:30:45and I will uh create an environment well
  1402. 1:30:48I will uh add to the path /h home and
  1403. 1:30:53this will be the path.
  1404. 1:30:57So if you are not familiar with the
  1405. 1:30:59Linux here I'm I'm providing like a
  1406. 1:31:03executable rights to this script and
  1407. 1:31:07when I run this script uh
  1408. 1:31:10by itself it will execute Python uh now
  1409. 1:31:13I will explain why uh what I'm doing
  1410. 1:31:16here is I'm defining the environment
  1411. 1:31:18variable path that uh when I execute
  1412. 1:31:23this
  1413. 1:31:26uh will be searched here in /home.
  1414. 1:31:31So I will uh save this.
  1415. 1:31:34Not sure if that makes sense. Oh, what I
  1416. 1:31:37wanted to if I do edit some
  1417. 1:31:44this part that is at the beginning of
  1418. 1:31:46the script means that if the executable
  1419. 1:31:50file sorry this file is executed as a XF
  1420. 1:31:55file let's say
  1421. 1:31:57along uh will use Python 3.
  1422. 1:32:04So if I oops I need to
  1423. 1:32:09exit.
  1424. 1:32:12So if I execute something like a
  1425. 1:32:15py
  1426. 1:32:17will use uh python 3 I will not need to
  1427. 1:32:20specify python 3.
  1428. 1:32:25I will not need to do this. Just by
  1429. 1:32:28doing this
  1430. 1:32:31uh the operating system will know that
  1431. 1:32:33we'll need to use Python 3 because of uh
  1432. 1:32:37this uh first line.
  1433. 1:32:45Hopefully it makes sense.
  1434. 1:32:47Oops. Uh this
  1435. 1:32:51I will save I will exit without saving.
  1436. 1:32:57Now if I compile the PMA
  1437. 1:33:03will be PMA image
  1438. 1:33:05B
  1439. 1:33:08again. Yeah.
  1440. 1:33:20And this will be version two.
  1441. 1:33:27And let's see if that uh so this other
  1442. 1:33:30way will be map container
  1443. 1:33:34run I can use some here I specify the
  1444. 1:33:39script this is useful for instance when
  1445. 1:33:41again we have several scripts and I can
  1446. 1:33:44put all of them in the same container
  1447. 1:33:48and here I can specify 10
  1448. 1:33:52um
  1449. 1:33:58Oops.
  1450. 1:34:01Ah, because I forgot to specify the name
  1451. 1:34:04of the
  1452. 1:34:07image that is sam version two
  1453. 1:34:14and you see that yeah this is like
  1454. 1:34:16another way. So we have different ways
  1455. 1:34:18to do the same. Uh depending uh I will
  1456. 1:34:21advise this way when we have several
  1457. 1:34:23scripts. If we have only one
  1458. 1:34:27probably
  1459. 1:34:29this way will be nicer.
  1460. 1:34:37This is all on the documentation but I
  1461. 1:34:39know that it's like a bit of um a lot of
  1462. 1:34:43load. Any questions uh about this or
  1463. 1:34:48anything
  1464. 1:35:18So, uh,
  1465. 1:35:30yeah, I think okay, that that's a I need
  1466. 1:35:33to but yeah, that uh when
  1467. 1:35:39no that's an interesting question when
  1468. 1:35:41when we run a container
  1469. 1:35:43uh and the container finish uh for uh if
  1470. 1:35:48something is going wrong just to double
  1471. 1:35:50check I think we can uh I need to I I
  1472. 1:35:54I'm not sure if I remember the syntax
  1473. 1:35:56but if I let let's try this
  1474. 1:36:01container
  1475. 1:36:04ls
  1476. 1:36:07Well, you will see that. Yeah, I have
  1477. 1:36:08like a lot of
  1478. 1:36:12But if I want to
  1479. 1:36:20Yeah, let's see if I can I
  1480. 1:36:25actually Let's check the
  1481. 1:36:27mount container.
  1482. 1:36:42They make this.
  1483. 1:36:48There is a way to
  1484. 1:36:52uh
  1485. 1:36:57Okay, here
  1486. 1:37:02I know this is a sandbox image.
  1487. 1:37:06There's also a command in a new oh no a
  1488. 1:37:08new container even
  1489. 1:37:11there is a way to uh for instance a
  1490. 1:37:13containers that I have already run to uh
  1491. 1:37:16access them again the thing is I don't
  1492. 1:37:19remember now the
  1493. 1:37:21the way I will check I'll let you know
  1494. 1:37:24but uh that that is a way of uh uh
  1495. 1:37:30yeah like a connecting there is a way so
  1496. 1:37:33uh actually
  1497. 1:37:40So we have oh well for in yeah you can
  1498. 1:37:43attach to a running container
  1499. 1:37:46clone an existing container
  1500. 1:37:50you can create but not start a container
  1501. 1:37:55run a pro. Yeah you have all of these
  1502. 1:37:57options.
  1503. 1:38:02You can keep the running container list
  1504. 1:38:06or
  1505. 1:38:15oh could be a start maybe
  1506. 1:38:25don't see that works but
  1507. 1:38:31now.
  1508. 1:38:34Yeah, I need to check. But yeah, that
  1509. 1:38:37must be like a one of these options that
  1510. 1:38:38are here in the I think that rather than
  1511. 1:38:41pman container run would be pman
  1512. 1:38:43container and something else.
  1513. 1:38:47But yeah, it's possible. This is more
  1514. 1:38:49for debugging to see what was wrong. And
  1515. 1:38:52yes, see if uh
  1516. 1:38:55uh I think let me check this P.
  1517. 1:39:03Well, this is another way that uh if
  1518. 1:39:05you're using inspect, you will see all
  1519. 1:39:07of the
  1520. 1:39:09all of the configuration of uh that the
  1521. 1:39:12container that I run
  1522. 1:39:16the arguments the path was created
  1523. 1:39:20state. Yeah, maybe that could be I mean
  1524. 1:39:23useful if something happened or
  1525. 1:39:26something was not
  1526. 1:39:31cool. So uh what I wanted to show you
  1527. 1:39:34that yeah now we said this is what let's
  1528. 1:39:36see what there are more things that uh
  1529. 1:39:41well could be done with the containers
  1530. 1:39:43but uh this is like let's see the
  1531. 1:39:45practice now we will see a little bit of
  1532. 1:39:48what theory and yeah finish uh for today
  1533. 1:39:52I will stop shading and I will share my
  1534. 1:39:58this Oh,
  1535. 1:40:03so uh the article is quite long. Uh it's
  1536. 1:40:07better if I mean you have the time and
  1537. 1:40:09you go. But uh is I I I find it quite uh
  1538. 1:40:12useful to uh uh to read and to learn how
  1539. 1:40:17to uh these are 10 simple rules for
  1540. 1:40:20writing docker files for reproducible
  1541. 1:40:23data science.
  1542. 1:40:25So what you have here the all of the ana
  1543. 1:40:28open this article is open access so you
  1544. 1:40:31can get access.
  1545. 1:40:34So these 10 rules are this one. Use
  1546. 1:40:36available tools. Build upon existing
  1547. 1:40:39images that this is the I mean we can go
  1548. 1:40:43probably
  1549. 1:40:44well yeah build upon existing images
  1550. 1:40:47format for clarity document within the
  1551. 1:40:50docker file specify the software
  1552. 1:40:51versions that this is something to be
  1553. 1:40:54yeah that let's see we haven't done use
  1554. 1:40:57version control mount data set and
  1555. 1:41:00runtime. Well, we have done that. Make
  1556. 1:41:03the image one click one one click
  1557. 1:41:05runable. That is yeah what we have done
  1558. 1:41:07at the end of order the instructions. So
  1559. 1:41:10well use and rebuild the containers can
  1560. 1:41:14go like a step up. Well this image is a
  1561. 1:41:19we have a docker file that we build and
  1562. 1:41:21we have the image with the different
  1563. 1:41:23layers and then we run the container
  1564. 1:41:25with this. So the key valent if I mean
  1565. 1:41:29it's not the same but kind of if we have
  1566. 1:41:33a source code here we compile the source
  1567. 1:41:36code so we have an executable binary and
  1568. 1:41:40every time that we run the binary this
  1569. 1:41:42will create a process on the operating
  1570. 1:41:44system. So every time that we run it,
  1571. 1:41:46this process will be different. The same
  1572. 1:41:49as this. Every time that we run the
  1573. 1:41:51container,
  1574. 1:41:53sorry, that we run the image, we will
  1575. 1:41:55have a different container.
  1576. 1:42:02Uh here there is more. So let's jump uh
  1577. 1:42:05to the rules. uh the use available tools
  1578. 1:42:08is uh
  1579. 1:42:11yeah there are like uh if we go to
  1580. 1:42:15docker hub or we go to documentation we
  1581. 1:42:18have already some templates with a
  1582. 1:42:20docker file so that recommends that uh
  1583. 1:42:24uh yeah use a docker file that is
  1584. 1:42:27already there in case that uh you want
  1585. 1:42:29to make a more complex uh uh workflow
  1586. 1:42:34uh build upon existing images again. If
  1587. 1:42:38you want to uh what we have said before,
  1588. 1:42:42okay, we can get Ubuntu Alpine build
  1589. 1:42:47Python build. But if we have already an
  1590. 1:42:50image that has a Python, use that image
  1591. 1:42:54rather than
  1592. 1:42:56doing all of
  1593. 1:43:00uh format for clarity to make the let's
  1594. 1:43:04say the docker file to make it readable
  1595. 1:43:07because this uh will be readed by
  1596. 1:43:12now if yeah by uh people so uh Don't
  1597. 1:43:18yeah give like enough space actually
  1598. 1:43:22this comes for the next uh well here is
  1599. 1:43:25like a way more but yeah I'm going like
  1600. 1:43:27a quickly to yeah it's better to have a
  1601. 1:43:30a better read with more time but uh this
  1602. 1:43:34is aligned with this like a document
  1603. 1:43:36within the docker file as I said you can
  1604. 1:43:39you can have a comment using the hash
  1605. 1:43:43key
  1606. 1:43:44so use it.
  1607. 1:43:48Oh yeah, you have a
  1608. 1:43:50uh you can also add metadata. We have we
  1609. 1:43:53haven't seen that but you have a label
  1610. 1:43:55instruction that you can say
  1611. 1:43:59who is the maintainer.
  1612. 1:44:02Yeah, you can add some lay labels there
  1613. 1:44:05here on on the docker file.
  1614. 1:44:09Define the versions define the
  1615. 1:44:12environment available. So yeah this is
  1616. 1:44:14like a
  1617. 1:44:17a specified software versions uh if you
  1618. 1:44:20remember we used we have used Python so
  1619. 1:44:23we have used well we have specified the
  1620. 1:44:26version that is Python 3 so we do APK
  1621. 1:44:30other Python 3 but uh what if we want uh
  1622. 1:44:333.8 eight. What if we want uh
  1623. 1:44:38for a library the specific version that
  1624. 1:44:41when we use Python we have a file that
  1625. 1:44:43is a requirements that normally we
  1626. 1:44:46specify the version there to make this
  1627. 1:44:49more
  1628. 1:44:52consistent is important to specify the
  1629. 1:44:55version of Python like a version and the
  1630. 1:44:58for the libraries as well because every
  1631. 1:45:01time that you build the container maybe
  1632. 1:45:03you build a different version of Python.
  1633. 1:45:05But if you specify it, you will always
  1634. 1:45:08build the same version of Python.
  1635. 1:45:11Hopefully that makes sense of when you
  1636. 1:45:13use the version control. This is what I
  1637. 1:45:16I mentioned before that uh our code that
  1638. 1:45:19we have added to the to the image we can
  1639. 1:45:25add it using Git clone.
  1640. 1:45:27But here I use the branch I use this uh
  1641. 1:45:30version. So of the check out I use
  1642. 1:45:33exactly this specific version. In case
  1643. 1:45:36that the repository gets a newer
  1644. 1:45:40versions
  1645. 1:45:41uh
  1646. 1:45:43it will always take the same uh
  1647. 1:45:46version of the script.
  1648. 1:45:52And yeah here like when I run the pep
  1649. 1:45:54install I specify the versions here.
  1650. 1:45:58However, another way is to add this to
  1651. 1:46:00the container. The requirements txt and
  1652. 1:46:04run deep install minus r requirements.
  1653. 1:46:07And again, requirements will contain the
  1654. 1:46:10versions of the Python libraries that we
  1655. 1:46:13will use.
  1656. 1:46:15Rule six, use version control.
  1657. 1:46:19uh
  1658. 1:46:20Docker file you can save it on a you can
  1659. 1:46:24save it on a GitHub repository and you
  1660. 1:46:26can see the versions of uh different
  1661. 1:46:29versions of the docker file. Actually we
  1662. 1:46:32have seen in the here when we use a
  1663. 1:46:35docker the docker hub you can click on
  1664. 1:46:38the version and you can go to the you
  1665. 1:46:41can go to the repository to the github
  1666. 1:46:44repository. I mention all the time
  1667. 1:46:46GitHub but we have a g lab I think there
  1668. 1:46:49is another one that is a bit bit bucket
  1669. 1:46:53I mean it's like a g repository
  1670. 1:46:59we have done this amount data sets at a
  1671. 1:47:02runtime so uh
  1672. 1:47:10yeah because that will make the you see
  1673. 1:47:14here that is mount type bid source that
  1674. 1:47:18will make it's better to uh mount a
  1675. 1:47:22folder rather than let's say copying the
  1676. 1:47:23whole content or that will make the the
  1677. 1:47:26let's see the container independent from
  1678. 1:47:28the files that we want to analyze I mean
  1679. 1:47:32I will never include the files on the
  1680. 1:47:34that they want to uh analyze on the on
  1681. 1:47:37the container one thing that is not uh
  1682. 1:47:41well was included but I haven't
  1683. 1:47:42mentioned important.
  1684. 1:47:45Do not include the passwords. Do not
  1685. 1:47:49include the We have seen a lot of uh
  1686. 1:47:52forgot the name. It's not a password.
  1687. 1:47:54there is uh some uh keys or some uh yeah
  1688. 1:47:58keys that are included on the container
  1689. 1:48:00and you upload them to docker or uh
  1690. 1:48:06GitHub and this uh I think it's secrets
  1691. 1:48:10this secret will no longer secret so I
  1692. 1:48:14mean will keep see the word but everyone
  1693. 1:48:19will see the password everyone will see
  1694. 1:48:21the or if you use SSH keys
  1695. 1:48:24Never include the private part of the
  1696. 1:48:28key on a container.
  1697. 1:48:32This is what we have done that make the
  1698. 1:48:34image a one click runnable. So we use
  1699. 1:48:37using entry point and cmd instructions.
  1700. 1:48:41Here we have some examples.
  1701. 1:48:45We have seen already that the rule name
  1702. 1:48:47all the instructions here is what is the
  1703. 1:48:50recommendation. So system libraries uh
  1704. 1:48:54language specific libraries
  1705. 1:48:56installation of our own software copying
  1706. 1:48:59data configuration files labors and
  1707. 1:49:02entry point. So if I you do a change
  1708. 1:49:04here you will not need to uh install of
  1709. 1:49:08go through all of these. So this will
  1710. 1:49:11build in top of so this is like the
  1711. 1:49:14recommended
  1712. 1:49:15order.
  1713. 1:49:17Uh this is a regularly use and build
  1714. 1:49:20containers. This is to check if uh uh to
  1715. 1:49:23check if the container the docker file
  1716. 1:49:26is still like relevant or still works
  1717. 1:49:29because for instance imagine that you
  1718. 1:49:31haven't specified the Python version and
  1719. 1:49:34you build the container in three weeks
  1720. 1:49:36time and maybe picks another version of
  1721. 1:49:39Python the script could stop working and
  1722. 1:49:43so it's like a good yeah way to check
  1723. 1:49:46that the uh the docker file is still
  1724. 1:49:50relevant.
  1725. 1:49:51But what this like a so you may as you
  1726. 1:49:55see there are some examples it's like a
  1727. 1:49:57quite long
  1728. 1:49:59would be good to read the article like
  1729. 1:50:01uh in your own time with and uh because
  1730. 1:50:06this is quite a I found it I find it
  1731. 1:50:09quite useful.
  1732. 1:50:13Oh to go to the this is the lesson. This
  1733. 1:50:17is the end of
  1734. 1:50:22a samples of using container images in
  1735. 1:50:24practice. We have a we don't see like a
  1736. 1:50:27GitHub actions. This is normally when we
  1737. 1:50:30uh for instance when you submit a code
  1738. 1:50:34you can have an action to either compile
  1739. 1:50:37the code and check if uh it works. Okay.
  1740. 1:50:40You can check the syntax grammar. uh you
  1741. 1:50:45can build an HTML
  1742. 1:50:48site. So uh in that case normally you
  1743. 1:50:52you uh use uh containers. So uh here if
  1744. 1:50:57we go here you have like a an example of
  1745. 1:51:00how to do that uh use for instance build
  1746. 1:51:03a GitHub pages using pandoc
  1747. 1:51:07but well this is like a you can go
  1748. 1:51:08through this sample but yeah this is
  1749. 1:51:12like a more related with the GitHub
  1750. 1:51:15uh yeah a bit uh
  1751. 1:51:18yeah we will not cover that but you have
  1752. 1:51:21that on the on the the documentation.
  1753. 1:51:24This is what we will see on Wednesday
  1754. 1:51:26using containers on an HPC cluster. you
  1755. 1:51:30will see how uh things uh I mean uh the
  1756. 1:51:35I mean change uh because on uh Wednesday
  1757. 1:51:39I will not explain on Wednesday we will
  1758. 1:51:42see why we using singularity or obtainer
  1759. 1:51:45rather than docker or podma on a on a sh
  1760. 1:51:49resource like a archer 2 or supercomput
  1761. 1:51:58Okay. Yeah. Thank you. Yeah, we are
  1762. 1:52:01finishing
  1763. 1:52:03soon. So, uh well, as I said, this is a
  1764. 1:52:06recording. So, you want to go through
  1765. 1:52:08the
  1766. 1:52:10content this will be
  1767. 1:52:15okay. So, uh and yeah, here what we are.
  1768. 1:52:18If you have an example, you can always
  1769. 1:52:20select a submit a p request. Uh this
  1770. 1:52:23lesson is in the carpentry
  1771. 1:52:26incubator. So uh you can suggest uh
  1772. 1:52:29changes to it.
  1773. 1:52:32And here there is like some theory
  1774. 1:52:36that that are yeah I will go go quickly
  1775. 1:52:40but well would be good like on your own
  1776. 1:52:43trying to read it more carefully and if
  1777. 1:52:46you have any questions so you can ask me
  1778. 1:52:48on on a Wednesday uh or well or by by
  1779. 1:52:53mail at any time. Again, one
  1780. 1:52:59containers are quite important for uh
  1781. 1:53:02reproducibility
  1782. 1:53:05because uh every time that we run the an
  1783. 1:53:08image uh we will use the same uh
  1784. 1:53:12if we build the image uh
  1785. 1:53:17specifying versions etc. we will use
  1786. 1:53:20always the same uh installation of the
  1787. 1:53:22same. If you open the docker file, you
  1788. 1:53:25see the set of uh
  1789. 1:53:28commands or instructions that you have
  1790. 1:53:30followed to uh install and run the
  1791. 1:53:33software. So this is documentation that
  1792. 1:53:36increase the that uh that this could be
  1793. 1:53:41reproduced by another person at a future
  1794. 1:53:44time.
  1795. 1:53:47uh sharing images you can share them on
  1796. 1:53:50docker hub or another way that is
  1797. 1:53:53explained here is uh you can archive uh
  1798. 1:53:57and identify the container images using
  1799. 1:53:59a sen the way to archive uh we can try
  1800. 1:54:04that so will be podman image save and
  1801. 1:54:07the name of the image our the output
  1802. 1:54:10will be alpine python tar to compile it
  1803. 1:54:14you need to use u I think in Windows is
  1804. 1:54:17not installed but you can you can
  1805. 1:54:19compile it with the uh GC or just zip
  1806. 1:54:24and uh you can deposit it on seno.
  1807. 1:54:29If you deposit it on seno it will create
  1808. 1:54:31a DOI that this is a digital object
  1809. 1:54:35identifier.
  1810. 1:54:38Yeah, this make this bigger
  1811. 1:54:45and you can reference on your paper or
  1812. 1:54:48somewhere else on any documentation that
  1813. 1:54:51you create this DOI.
  1814. 1:54:58So good practice. Yeah. Again containers
  1815. 1:55:01to uh because this is like everything
  1816. 1:55:03documented on the docker file. You have
  1817. 1:55:07a yeah you have the document what you
  1818. 1:55:10have done. Why uh you have a DOI that
  1819. 1:55:14you can reference. You can use make use
  1820. 1:55:16of tax. Um
  1821. 1:55:22yeah it's good to provide the let's say
  1822. 1:55:25the build image but having also
  1823. 1:55:28providing the docker file uh everyone
  1824. 1:55:31will see the recipe understand and build
  1825. 1:55:34it just in case that
  1826. 1:55:38uh container granularity the here
  1827. 1:55:44you have some positives and negatives.
  1828. 1:55:47There are two options. You can the
  1829. 1:55:49granularity means that you can have like
  1830. 1:55:52a depending on the
  1831. 1:55:55well workflow or what you want to uh you
  1832. 1:55:59can have a big
  1833. 1:56:01image that contains uh all of the your I
  1834. 1:56:06mean if uh you have only one script fine
  1835. 1:56:09you create one image and that's it. But
  1836. 1:56:12if uh you have a several scripts or if
  1837. 1:56:16this is part of imagine that you have a
  1838. 1:56:18workflow that you have a pipeline of
  1839. 1:56:22four different processes you can have
  1840. 1:56:25these four different processes in the
  1841. 1:56:27same image
  1842. 1:56:30the advantage that yeah you have only
  1843. 1:56:32one fine but disadvantage that you will
  1844. 1:56:35have like a big um
  1845. 1:56:38let's see that for one process you use
  1846. 1:56:40Python for the second one Maybe you use
  1847. 1:56:42R for the third one this runs uh using a
  1848. 1:56:48no for so in one image you will have
  1849. 1:56:51everything installed so in that case
  1850. 1:56:54maybe more recommen it's recommended to
  1851. 1:56:57use several
  1852. 1:56:59here you have the advantages and
  1853. 1:57:00disadvantages
  1854. 1:57:03the advantages is simple to document but
  1855. 1:57:06yeah could be very large in size having
  1856. 1:57:09multiple
  1857. 1:57:11is
  1858. 1:57:13well more difficult to comment or maybe
  1859. 1:57:15maintain but it will make things uh
  1860. 1:57:20uh clearer. So uh yeah it's up to the
  1861. 1:57:24test case that uh but uh yeah my
  1862. 1:57:28recommendation or I would be tempted to
  1863. 1:57:31yeah to have a multiple smaller
  1864. 1:57:33container images rather than a big one.
  1865. 1:57:39This is uh the what I wanted to cover uh
  1866. 1:57:44today on the
  1867. 1:57:46if you have any
  1868. 1:57:50other questions before we
  1869. 1:57:54leave. If not uh
  1870. 1:58:01we can yeah we'll be uh we'll uh
  1871. 1:58:06yeah so that's uh yeah that's all for
  1872. 1:58:09today. Uh here yeah you have
  1873. 1:58:12documentation have a look and play with
  1874. 1:58:14the samples. So you have the article is
  1875. 1:58:17like on the is here
  1876. 1:58:22at the end. Yeah, the article is here in
  1877. 1:58:25the in the lesson
  1878. 1:58:29number.
  1879. 1:58:32Yeah, seven. So, this is what we have
  1880. 1:58:34covered. So, we in your own time have a
  1881. 1:58:38quick look on and yeah, thank you for
  1882. 1:58:42attending today. See you on Wednesday.
  1883. 1:58:44On Wednesday, we will use uh Archer to
  1884. 1:58:47uh to uh to run uh uh Singularity to uh
  1885. 1:58:53we will see how to uh uh download uh
  1886. 1:58:56images and run them on Archer 2. Uh have
  1887. 1:59:00a nice rest of the day. Um yeah, see you
  1888. 1:59:03on Wednesday. Bye. Bye for now.
  1889. 1:59:05>> Thanks. Thanks a lot.

About this transcript

This page contains the full transcript of ARCHER2 - Containers for Reproducible Research: Introduction to Podman and Singularity - Session 2 by ARCHER2 HPC, generated from the public captions YouTube serves with the video. The transcript has 11,863 words across 1,889 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.