Running in a container#
Section author: Lars Bilke (Helmholtz Centre for Environmental Research GmbH - UFZ)
Running with Docker#
A prebuilt Docker image with the latest (nightly build) ogstools
and all features can be used:
docker run --rm -it -v $PWD:$PWD -w $PWD registry.opengeosys.org/ogs/tools/ogstools/main-3.10
# Now in the container:
ogs --version
# test if feflow2ogs is available:
feflow2ogs -h
...
python
# Now in a Python console:
import ogstools as ot
...
This command works only in the powershell.
docker run --rm -it -v ${PWD}:/working_dir -w /working_dir registry.opengeosys.org/ogs/tools/ogstools/main-3.10
# Now in the container:
ogs --version
# test if feflow2ogs is available:
feflow2ogs -h
...
python
# Now in a Python console:
import ogstools as ot
...
/working_dir
is an arbitrary name of a path into which the current working directory (PWD
) is mounted in the Docker container.
Danger
Be aware that inside the container you are the root
-user and if you write files they are owned by root
too. When you exit the container and you are your regular user on your host again you will have no permissions to access these newly created files! There is no easy solution to this problem but you may consider using Apptainer (see below).
Note
The container is based on the devcontainer with ogstools
installed:
FROM registry.opengeosys.org/ogs/tools/ogstools/devcontainer-3.10
RUN --mount=target=/ogstools,type=bind,source=.,readwrite \
pip install /ogstools[feflow] \
&& pip uninstall vtk -y
RUN pip install --extra-index-url https://wheels.vtk.org vtk-osmesa \
&& pip install -i https://gmsh.info/python-packages-dev-nox gmsh
ENTRYPOINT bash
Running with Apptainer / Singularity#
The prebuilt Docker image can also be run with Apptainer (formerly known as Singularity):
apptainer shell docker://registry.opengeosys.org/ogs/tools/ogstools/main-10
The above command will open a shell in the container. Your home-directory is automatically mounted and you are the same user as outside the container. There will be no file permission issues as with Docker.