[Gate-users] vGATE in Docker

Dávid Völgyes david.volgyes at gmail.com
Thu Jun 26 16:19:28 CEST 2014


Dear Gate users,

vGATE is nice, it really makes the first steps easier, but it runs in
a virtualbox which is resource hungry compared to a native solution.
However, it the last year another virtualization solution appeared,
this is the "docker".
Docker is an operating system level virtualization, therefore it does
not emulate CPU instructions, and in a lot of way, it's much lighter
than a classic virtual machine, and also much faster. An application
inside docker runs almost with native speed, the kernel only checks
the rights (e.g. file access, etc.)
( http://en.wikipedia.org/wiki/Operating_system%E2%80%93level_virtualization )

So if you use 64bit Linux with kernel 3.8 or fresher, then you can use
docker. Windows machines, 32bit distributions, etc. are not supported,
or not in a way you think. (On windows docker starts a linux kernel
inside a virtual machine, so you lose the "lightweight" part.)

Docker is not an ultimate solution, but it is another option. Almost
like a virtual machine from management point of view with almost
native speed. Still, the native compiled GATE and the vGATE virtual
environment will have their roll, and docker is somewhere between
these two. There is another big deal with docker: portability. You can
move/copy your docker images inside your cluster and even the largest
cloud providers directly support docker images. (E.g. Google Cloud
Engine)

Of course, you should read the docker documentation: http://docs.docker.com/

Well, how can you access the docker image?
First of all, you can create yours if you do not trust in my version.
Copy the content of the vGATE image into a tar.gz file, import it from
Docker, and run it with "su gate -l " option which will simulate a
login.

But I already made this, and a bit more. Docker has a hub (
https://registry.hub.docker.com/ )  where image files can be shared.
I published two vGATE image there: dvolgyes/vgate3 and dvolgyes/vgate3_vanilia.

The vanilia version means that it's unmodified (except I deleted the
apt cache to reduce the size.) It is nothing more than an imported
filesystem from the official vGATE image.
The dvolgyes/vgate3 image is a bit modified. First of all, if you run
it without parameters, then it will start a shell as "gate" user, and
everything has been set. But you can also run Gate directly (or other
scripts) in a non-interactive mode. For this I had to set some
environmental variables, and I had to modifiy the bash config files. I
also added "sudo" rights to the "gate" user. This image is better than
the vanilia, but I also wanted an unmodified version, because it can
be a good start for other customizations.

So the easiest way to try it:

docker run -t -i dvolgyes/vgate3 [COMMAND]

Where command can be anything, e.g. your simulation script, or just
"Gate", or anything else.
If you do not give any command, then a shell will start.

You can share directories between the host and the container, with
this: -v /HOSTDIR:/GUESTDIR
E.g.
docker run -v /opt/my_latest_simulation/:/opt/sim/ -t -i
dvolgyes/vgate3 /opt/sim/simulation.sh

The "run" command generates a new container every time from the image.
(Image is a read-only thing, container is an execution environment.
The relationship is like the class and object have in C++) When you
left the executed container, next time you probably want to start this
container with the "start" command.
You really should check the docker documentation at this point, at
least to understand the "run", "start" and the other command line
options in the above examples.

Docker images are generated from "Dockerfile" which is a kind of
recipe to build the image. I published mine at github, if you want to
check it, modify it, etc. Of course, it would be possible to recompile
GATE inside a docker container, but I wanted to stay as close as
possible to the vGATE version, so I use the exact same binaries. This
way you can easily compare the performance of the virtualbox and the
docker version.

So the github repository:  https://github.com/dvolgyes/dockerfiles
(Check the GATE directory.)

I encourage everybody to try and use docker in general, because it's
cool. E.g. you can have several GATE/ROOT/Geant environments on the
same machine, and they are separated and still fast. You can use
cutting edge git version and change back to any previous version in a
few seconds. And so on.

Well, that's it. I hope it will be useful.
If you have any problem related to the docker images, please let me know.
But please, do not ask about GATE, read the GATE manual instead. The
same is true for vGATE and for docker (commands, install, etc.)


Best regards,
  David
u.i.: I know that I did not finish the README file on github. I will
do it sometime.


More information about the Gate-users mailing list