Working with Docker and Singularity
CyVerse recently taught a Container BootCamp with in depth instructions for working with Docker and Singularity.
In these examples we'll use Singularity to launch both Docker and Singularity containers.
Description: Run CLI and GUI programs on VMs using Docker & Singularity Containers
If you're running on Windows OS you can set up the Windows-Linux subsystem to access a real Linux terminal. This will enable you to run secure shell connections to your VM.
Another option is to use the Atmosphere Web Desktop, which is running an XFCE Desktop.
Build a Singularity Container yourself
If you want to develop your own containers you can download the example Singularity file from my Github repository and make your own changes
To install Singularity on linux follow these instructions.
As of early May 2018, Singularity is version 2.5.1
VERSION=2.5.1 wget https://github.com/singularityware/singularity/releases/download/$VERSION/singularity-$VERSION.tar.gz tar xvf singularity-$VERSION.tar.gz cd singularity-$VERSION ./configure --prefix=/usr/local make sudo make install cd .. sudo rm -rf singularity-$VERSION.tar.gz
Singularity build dependencies:
Get the Singularity file from terminal:
- Clone github repository onto the VM (e.g.
git clone https://github.com/tyson-swetnam/osgeo-singularity cd osgeo-singularity
Singularityfile and view it if you like, make any changes you wish.
- Build the container locally:
sudo singularity build osgeo.simg Singularity
Download the Container from Singularity-Hub
The container image is hosted on Singularity Hub and can be downloaded from there.
- Pull the image from Singularity-Hub
singularity pull --name osgeo.simg shub://tyson-swetnam/osgeo-singularity
Running CLI scripts
To run the container from the CLI:
singularity shell osgeo.simg
Running a container from your Jupyter Notebook (Python3)
Run GUI Applications
Run the container with the
singularity exec command to use the GUI applications, the interface for GRASS:
singularity exec osgeo.simg grass74
GRASS 7.4 has a problem with its environment variables not being set within the container. You can do this by hand while the container is running:
singularity shell osgeo.simg GISBASE=/opt/osgeo/grass-7.4.0 GRASS_PROJSHARE=/usr/share/proj LD_LIBRARY_PATH=/opt/osgeo/lib:/opt/osgeo/grass-7.4.0/lib PATH=/opt/osgeo/bin:/opt/osgeo/grass-7.4.0/bin:$PATH PYTHONPATH=/opt/osgeo/lib/python3.6/site-packages export GISBASE GRASS_PROJSHARE LD_LIBRARY_PATH PATH PYTHONPATH grass74
singularity exec osgeo.simg qgis
singularity exec osgeo.simg saga_gui
Running the GUI applications requires a stable, fast, internet connection, else loading large raster layers may be very slow.
You must use the Atmosphere Web Shell or
ssh -X in the terminal to access the Container's GUI applications.
ssh -X <USERNAME>@<IP-ADDRESS>
If you are using the Web Desktop, you can resize the screen by opening the terminal emulator and typing
SZ: Pixels Physical Refresh 0 1024 x 768 ( 260mm x 195mm ) 0 1 800 x 600 ( 203mm x 152mm ) 0 2 1280 x 800 ( 325mm x 203mm ) 0 3 1280 x 960 ( 325mm x 244mm ) 0 4 1280 x 1024 ( 325mm x 260mm ) 0 5 1680 x 1050 ( 427mm x 267mm ) 0 6 1920 x 1080 ( 488mm x 274mm ) 0 *7 1920 x 1200 ( 488mm x 305mm ) *0 8 3360 x 1050 ( 853mm x 267mm ) 0 9 1024 x 700 ( 260mm x 178mm ) 0 10 1200 x 740 ( 305mm x 188mm ) 0 11 1600 x 1000 ( 406mm x 254mm ) 0 12 1600 x 1200 ( 406mm x 305mm ) 0 13 3200 x 1000 ( 813mm x 254mm ) 0 14 3200 x 1200 ( 813mm x 305mm ) 0 Current rotation - normal Current reflection - none Rotations possible - normal Reflections possible - none
This will show you the list of possible screen resolutions. To reset the screen resolution to HD (1920x1080):
xrandr -s 6
Fix or improve this documentation