Sign inSign up

jeffersonlab/cernlib

By jeffersonlab

Updated 6 months ago

unofficial cernlib image including paw, paw++ and libgeant321. A gfortran compiler is also included.

Image
0

5.3K

jeffersonlab/cernlib repository overview

CERNLIB

This image includes a version of cernlib with paw and paw++. It has been used to run cernlib on Mac OS X, though it's docker so should work anywhere. Note that we do not author or maintain this code. Details on the software and licensing can be found at https://cernlib.web.cern.ch

Quick start:

  • make sure your X11 server can accept localhost connections ("xhost +" if you don't mind being unsecure)
  • make sure docker is installed and running (https://docs.docker.com/engine/install/)
  • Use one of these commands to fire up a container
# bash
docker run --rm -it \
  --user "$(id -u):$(id -g)" \
  -e DISPLAY=host.docker.internal:0 \
  -e LIBGL_ALWAYS_INDIRECT=1 \
  -v "$PWD:/work" \
  -w /work \
  jeffersonlab/cernlib:2026
  # tcsh
  docker run --rm -it \
  --user "`id -u`:`id -g`" \
  -e DISPLAY=host.docker.internal:0 \
  -e LIBGL_ALWAYS_INDIRECT=1 \
  -v "`pwd`:/work" \
  -w /work \
  jeffersonlab/cernlib:2026

This will mount your current working directory under /work and drop you there. It will also map your user id in the container to the host user id so your file permissions will be right.

Code

The 2026 version was compiled from code found here:

https://cernlib.web.cern.ch/download/2026_source/tar/cernlib-cernlib-2026.01.08.0-free.tar.gz

The size of the PAW common (NPAW) was increased from 2M to 10M though to give more space for histograms.

OLDER (pre 2023 versions)

It is most convenient when used with the X11 server on the host (XQuartz on Mac OS X). Included in the image is a script "dsh" that can be used to setup a user with the same username and uid/gid as the host. See the DSH section below for details.

Please note that this is provided as-is with no guarantee that it will work for all cases. I have not modified the cernlib software in any way. I have merely packaged it into a container in order to extend its life a little longer given that it is still useful for a number of people. Having said that, if you have issues with the container that I may be able to help with, you can contact me at: davidl @ jlab.org.

QUICKSTART

> mkdir cernlib_home
> export DSH_DEFAULT_ARGS="-gdb -v $PWD/cernlib_home:$HOME" 
> docker run --rm -it jeffersonlab/cernlib:2023 cat /container/image/dsh | tr -d "\r" > dsh
> chmod +x dsh
> xhost + `hostname`
> ./dsh jeffersonlab/cernlib:2023
docker:~$ paw++

If you get error messages when starting docker indicating port 5900 is already in use, try modifying the DSH_DEFAULT_ARGS variable:

export DSH_DEFAULT_ARGS="-cp -gdb -v $PWD/cernlib_home:$HOME" 

DSH

dsh is a helper script that integrates the docker container with the host system to allow persistence, even if the container is stopped and a new one started later. It also re-uses an existing container with subsequent invocations of dsh. This allows one to open as many dsh windows as needed without launching a separate container for each (like you would normally do with xterms).

The main thing dsh does is create a user with the same username and uid/gid as the host so that any files created in the container will be compatible with the host system. It also mounts the user's home directory on the host as "home_host" inside the container. This makes it easier to work with files on the host.

The dsh script must be run on the host, but a copy is distributed inside the image itself. To copy the script out of the image to the local directory do this:

> docker run --rm -it jeffersonlab/cernlib:2023 cat /container/image/dsh | tr -d "\r" > dsh
> chmod +x dsh

Run the dsh script to create a container and add your username. You'll probably want to make sure the host's X11 server will accept connections from the container first. Note that the xhost + command with no explict hostname is considered very insecure since it allows X11 connections from anywhere. It is recommended to specific the host machine as an argument as shown below.

> xhost + `hostname`
> ./dsh jeffersonlab/cernlib:2023
docker:~$ paw++

The last line should bring up the paw++ windows. If it doesn't then make sure your X11 server is running on the host (see https://www.xquartz.org/) and try running something like xterm to verify it is working.

Here is the help message for dsh. You can get this also by running dsh -h.

 This script is used to optionally launch and then attach to
a docker container. It is meant to make it easy to use the
container like a virtual machine by just typing 'dsh' to 
jump into the container and launch a new shell. The other key
feature is it will create a user and group with the same name
and id as the local system so it is easier to work in a shared
directory with the host.
 
If a container does not already exist, a new one is created
and the following actions performed on it by default:
 
1.\) A new user is added that has the same username, uid, and
    gid as the user running dsh on the host
 
2.\) The user\'s home directory on the host is mapped to the
    container with a link called 'home_host' in the home
    directory inside the container.
 
3.\) The host /tmp directory is mapped to /tmp_host in the
    container.
 
4.\) The command used to run the container is 'sleep infinity'
    which means the container will not exit when you exit
    from dsh. (use dsh -s to stop a container created by dsh)
 
 
Multiple instances of dsh can be run at the same time, each
representing a different shell process in the same container.
You can stop and remove a continer with dsh -s (or using the
docker stop and rm commands directly).
 
The following environment variables can be used to override the
default values in dsh:
 
DSH_SHELL          sets command to be run (e.g. tcsh) This is superceded 
                   by the -c command line option if given
 
DSH_NAME           sets name of container on startup. Useful for 
                   communicating with other containers, but not much else
 
DSH_DEFAULT_IMAGE  set the docker image used. This is superceded
                   by the the command line argument if given
 
DSH_DEFAULT_ARGS   set default arguments to the docker run command.
                   This is useful if you wish to set docker options in
                   say, a login script so they don't need to be added
                   to the dsh command line explicitly. For example,
                   setting this to something like the following will
                   cause a directory on the host to be mounted as the
                   home directory for user davidl providing some 
                   persistence of config. files across containers.
 
                 '-v /Users/davidl/builds/Linux-Docker/home/davidl:/home/davidl'
 
Usage:
       dsh [options] [imagename]
 
options:
     -h,--help     Print this usage/help statement
 
     -u  user      Set the user to 'user' instead of the one
                   running this script.
 
     -c  command   Set the command to be run inside the container
                   The default is to use the DSH_SHELL environment
                   variable and if that is not available then 'bash'
 
     -v volume     Specify a volume to be mapped to the container.
                   The format is just the host_dir:container_dir
                   format docker uses. This may be specified more
                   than once and all directories will be mapped.
                   This only affects when the container is first
                   started.
 
     -cv           Clear volumes. This will clear out the list of
                   volumes to be mapped, including any specified 
                   using the -v option above. The only real use of
                   this is to prevent the user\'s home directory on
                   the host from being mapped since it is added to
                   the list by default. 
 
     -p            Expose port to outside of container. This should
                   be in standard container_port:host_port format
                   used by the docker run command. By default, ports
                   6080 and 5900 are exposed
 
     -cp           Clear ports. This will clear out the list of
                   ports to be mapped. This is really only useful
                   for removing the default ports so that they are
                   not mapped.
 
     -gdb          Add '--security-opt seccomp=unconfined' to the run
                   command to allow gdb to work. This can only be done
                   when the container is first created
 
     -s            Stop and remove the container
 
     -U+           Force addition of ubuntu style adduser args when
                   creating the container (see note below)
 
     -U-           Do NOT add ubuntu style adduser args when creating
                   the container (see note below)
 
Users
------------
The use of the -u option should be consistent throughout the
life of the container. More specifically, dsh will only create
a user when the container is first created. Subsequent invocations
of dsh will see the existing container and connect to it without
trying to create a new user. Users defined in the image itself
(e.g. root) are always available.
 
Ubuntu style adduser arguments:
------------
When running adduser on an
ubuntu-like system, it will normally prompt the user for
additional information such as password, full name, ...
If this happens, this script will fail at that point. Additional
arguments can be passed to avoid this, but they will cause the
adduser call to fail on other centos-like systems. By default,
this script will try and guess if this is ubuntu-like just from
the image name. The -U+ and -U- command line options will disable
this guessing and force the options to be or not be included.

KNOWN ISSUES

X11 window dies unexpectedly

At this point there is a problem that paw and paw++ sessions will die after some time with messages like the following:

  XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server "host.docker.internal:0.0"
  after 2143 requests (2136 known processed) with 0 events remaining.

Web searches indicate this is a problem with libxcb, but following the advice there (using version 1.5-1) has not resulted in a fix yet.

Crash due to exceeding 32bit address space

The following error has been observed using libgeant321 with the cernlib:2004 image:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
LOCB/LOCF: address 0x7f8dc3461e80 exceeds the 32 bit address space
or is not in the data segments
This may result in program crash or incorrect results
Therefore we will stop here
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

In that particular instance the problem was resolved by using the cernlib:2005 image

Tag summary

Content type

Image

Digest

sha256:8eba7ce8f

Size

596.1 MB

Last updated

6 months ago

docker pull jeffersonlab/cernlib:2026