Docker Environments - nasa/gunns GitHub Wiki

We provide Dockerfiles for you to easily build your own Docker images that provide environments for using GUNNS in containers. You only need the free basic Docker app.

'Unloaded' Image

This includes everything except the GUNNS repository:

  • a linux (CentOS 7) environment
  • all of the NASA Trick and GUNNS compile dependencies
  • NASA Trick is built into /home/trick
  • The Draw.io desktop application
  • The CPPUNIT unit testing framework, as well as LCOV and Valgrind, are installed for unit testing GUNNS source code.
  • The Firefox browser (for viewing LCOV outputs)

This is meant for you to map your local host gunns/ folder into the container at run-time.

To build this image, go to the gunns/docker/ folder, then:

$ docker build unloaded -t gunns_unloaded

It should take 5-15 minutes to build the image. The image should be roughly 2.8 GB in size.

To run the image:

$ docker run -it <OS display export> -v <your gunns folder absolute path>:/home/gunns gunns_unloaded

where:

  • <OS display export> is replaced with the syntax for exporting graphics to your local display, based on your local OS. See Exporting Graphics to Local Display below.
  • The -v option maps your local gunns/ folder (given by its absolute path in your file system) to the /home/gunns/ folder in the container.

More notes about the image:

  • Trick is built into the /home/trick/ folder
  • Environment variable TRICK_HOME points to /home/trick
  • /home/trick/bin/ is added to $PATH
  • Environment variable GUNNS_HOME points to /home/gunns
  • Draw.io can be started with this command: $ drawio --no-sandbox

'Loaded' Image

This builds on the 'gunns_unloaded' image by installing a fresh clone of GUNNS into the image at /home/gunns. It also builds the various GUNNS compiled libraries in gunns/lib. This is meant for convenience when you want a complete image with GUNNS and all of its dependencies and related tools installed.

To build this image, first build the 'gunns_unloaded' image (above). Then in the gunns/docker folder:

$ docker build loaded -t gunns_loaded

This will take around 5 minutes to build, and should be roughly 3.5 GB in size.

To run the image:

$ docker run -it <OS display export> gunns_loaded

Exporting Graphics to Local Display

If you want to see graphics generated by the applications inside the Docker container on your local display, you have to do some extra steps. Some things you might want to display from inside the container are:

  • The Trick GUIs, for moding & controlling the sim, peeking & poking variables, displaying strip charts,
  • Draw.io, for drawing and editing GunnsDraw model drawings,
  • Firefox, for viewing the LCOV reports generated by the unit tests.

The steps you take to connect the container to your display differ by OS:

Linux

Use this syntax for the <OS display export> part of the Docker run commands above:

-v /tmp/.X11-unix:/tmp/.X11-unix --env DISPLAY=$DISPLAY

OSX

First you must take a few extra steps. More info about this here: https://learning-continuous-deployment.github.io/docker/images/dockerfile/2015/04/22/docker-gui-osx/

  • If socat isn't installed, install it:
    • # brew install socat
    • ...then reboot
  • In a separate shell, start XQuartz:
    • # open -a XQuartz
  • In another shell, expose the local XQuartz socket via socat on a TCP port:
    • # socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
    • Leave that running while you run the Docker container.

Then use this syntax for the <OS display export> part of the Docker run commands above:

-e DISPLAY=<host IP address>:0

where you substitute your actual host IP address. This can be found in System Preferences > Network, the address is listed under Status: Connected

Windows

TBD