Okay. So yeah, this is going to be a very, very simple demo. I created a few Docker files
and I'll just show you how to build it. It's not rocket science, it's just maybe a refresher
and how to push it on Docker Hub as well if we have time. So let's see how far we can
get. So here I created a demo folder. In this demo folder I just have two files, one Docker
file and a test.c file. If I have a look at the Docker file, it goes like this. So from
my base image is in this case Ubuntu 18.04. Do some stuff on top of it. Okay. So the first
thing we do in particular with Debian based systems is to run an apt-get update to have
everything up to date. Otherwise you will not find mirrors or outdated mirrors for Ubuntu
libraries. Then what I do is to install GCC on top of this container. So in this case
I'm not...
Sorry, Stefano? Can I ask something very quickly? I'm not sure if you're updating, if you're
trying to show us the Docker file, but we only see your terminal.
Is this... Yeah. Do you see my highlight?
No.
I only see your terminal.
But the highlight in the terminal. No?
No. The terminal in the last command is exit.
Sorry, I didn't hear you.
We see only a terminal in which the last command is exit. Probably type exit in a terminal,
but then the screen share didn't follow to another one.
Okay. No, but this is because... Okay. So let me re-share. Yes, it's wrong. It's wrong.
The problem is that with Zoom I cannot share... Let's see if I can just... Can you see the
entire screen now?
Yes.
But if I do this, do you see now some code or do you still see the terminal?
Not a code.
Okay. So this is... Okay. Good. Okay. So I didn't do much. I just... So let's start over.
It's just very simple. I just said that I created a demo folder here with these two
files. Can you see them now?
Yes.
Yes. Okay. Perfect. And I just said that I was just showing how this Docker file is assembled
basically, which is from Ubuntu 18.04, which is the base image on which we will base the
container.
So I run an apt-get update and those run commands are just saying to the Docker engine when
it builds the container to run this command. This is something... It's just executing a
shell command basically. Okay. And then here I am running an apt-get install of the package
build essential. And in this case, I am installing the GCC compiler with this command. So I'm
not extending the GCC container. I'm just starting from... I'm starting from a clean
Ubuntu, which is in day-to-day work way more practical. So you choose what to do. And I
noticed that on Ubuntu 18.04, the GCC version is 7.4. So I can still have some control over
version here. I could have, of course, checked out a specific version, but this is enough
for the moment. The minus why it's super important because otherwise the build will fail because
when you build a container, you cannot have any input from the user. So it is... It must
be automated. So let's briefly just to give an idea what happens if I remove this minus
why. So I can also see how do I build this and then we will add it again. Okay. So the
Docker file I'm going to try to build now is this one as shown. The command is Docker
build dot, which stands for the directory I am in now. So if I do this, there are things
that we... Okay. Perfect. Okay. So since I already had pulled Ubuntu 18 on my computer
because I used it in another container, I am not downloading it again. So I'm reusing
the entire Ubuntu 18 distribution I had. The apt-get update was already run like an hour
Zugänglich über
Offener Zugang
Dauer
00:17:21 Min
Aufnahmedatum
2020-07-27
Hochgeladen am
2020-07-28 02:06:24
Sprache
en-US
Speaker
Stefano Alberto Russo, INAF
Content
Live Demo of building and running a Docker container.
The Workshop
The Workshop on Open-Source Software Lifecycles (WOSSL) was held in the context of the European Science Cluster of Astronomy & Particle Physics ESFRI infrastructures (ESCAPE), bringing together people, data and services to contribute to the European Open Science Cloud. The workshop was held online from 23rd-28th July 2020, organized@FAU.
Copyright: CC-BY 4.0