nicer entrypoint treatment
The CMS environment is not set up unless one calls shell scripts explicitly. Compare:
$ docker run -i -t --rm clelange/cmssw:5_3_32 env | sort > env1
$ docker run -i -t --rm clelange/cmssw:5_3_32 bash -c env | sort > env2
$ docker run -i -t --rm clelange/cmssw:5_3_32 bash -c 'source /home/cmsusr/.bashrc && env' | sort > env3
$ wc -l env?
6 env1
9 env2
109 env3
124 total
Note that only the latter case sets properly all the various CMS environment variables (such as CMSSW_BASE
, PYTHIA8DATA
and friends). However, one has to explicitly call shell startup scripts before calling a command.
This could be made nicer by introducing entry point wrapper scripts (such as explicit entrypoint.sh
) that would take care of setting the environment variables as necessary before running commands. See reana-env-aliphysics
for inspiration:
- https://github.com/reanahub/reana-env-aliphysics/blob/master/Dockerfile#L48
- https://github.com/reanahub/reana-env-aliphysics/blob/master/entrypoint.sh
This gives an easier user interaction:
$ docker run -i -t --rm reanahub/reana-env-aliphysics:vAN-20180614-1 env | sort > env1
$ docker run -i -t --rm reanahub/reana-env-aliphysics:vAN-20180614-1 bash -c env | sort > env2
$ wc -l env?
56 env1
56 env2
112 total
One can run commands directly without having to source anything.