These are chat archives for Fortran-FOSS-Programmers/General-Discussion

16th
Feb 2017
Stefano Zaghi
@szaghi
Feb 16 2017 05:14

@zbeekman Maybe I found an answer

https://www.theodo.fr/blog/2015/04/docker-and-virtualenv-a-clean-way-to-locally-install-python-dependencies-with-pip-in-docker/

It seems that I can mount some paths of a running-docker-image into my system. If this is true, I can mount your (docker image) gfortran-PATH somewhere in my system (say /opt/zaak-gfortran/) and then load it as my other modules... I'll try later today.

Cheers

Stefano Zaghi
@szaghi
Feb 16 2017 05:30

@zbeekman

Zaak, I am sorry to bother you, but docker remains ambiguous for me.

See this guide

https://docs.docker.com/engine/getstarted/step_three/#/step-2-run-the-whalesay-image

It seems it is possible to use docker to directly run a program (the shell program whalesay in that case) in the host system, i.e.

docker run docker/whalesay cowsay 'hello Zaak'

So my new question: is it possible to dockerize gfortran in that way? say to be able to run

docker run zaak/gfortran 'foo.f90 -o foo'

Cheers

Izaak "Zaak" Beekman
@zbeekman
Feb 16 2017 18:43
Hi Stefano, let me get back to you. I'm pretty sure it shouldn't be too hard to set this up so you can invoke GFortran directly from Docker (like whalesay) however, the compiled code may not run natively on your system outside docker due to glibc, libgfortran etc.
Also, I think you shouldn't have any problem just mounting your entire home directory in docker, except, perhaps, runtime issues if you try to natively run code you compiled with docker.
Izaak "Zaak" Beekman
@zbeekman
Feb 16 2017 19:54
Stefano, yes it is possible to implement what you're asking... I can try to make an additional tag to provide gfortran, gcc and g++ (each) that will share the same image components except for ENTRYPOINT and CMD
but in the mean time, if you pass something like -c "gfortran --version" or -c "gfortran /path/to/mounted/source/file.f90 && /path/to/mounted/source/a.out" you should be able to use dockerized gfortran with the image as it stands
Izaak "Zaak" Beekman
@zbeekman
Feb 16 2017 20:01
At some point I'll look into providing direct calls into gfortran/gcc/g++ but not for a while probably
Izaak "Zaak" Beekman
@zbeekman
Feb 16 2017 20:09
Basically the entry point is the command that the image runs, in this case /bin/bash and the CMD is -l which is the default arguments to be passed to the ENTRYPOINT. If you add extra text after docker run .... it will replace CMD with that extra text. So you can run arbitrary commands by passing either -c "my raw bash commands here like calls to /usr/local/bin/gfortran" or you could pass it a script that is somewhere already cross mounted with the container.
Hope this helps, @szaghi
Stefano Zaghi
@szaghi
Feb 16 2017 20:26

@zbeekman
Thank you very for your kind replays.

Today I played with docker for learning aims... I tried to achieve a sort of cross-compiling without success, but I had few minutes for my tests, I hope to be more lucky tomorrow. However, I have a request for you: I tried to compose your image with another providing python 2.7, but docker-compose is really non intuitive (IMO) and it seems not so trivial at least at the beginning; can you modify your image to include a python 2.7 interpreter? Without a python interpreter I cannot use FoBiS thus my productivity becomes close to zero... having a python interpreter into your gcc docker image let me to source any virtualenv I created for each Fortran project... it will become very handy.

Cheers