Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Markdown
# FAQ

## General

### How to make data available inside Docker container?

Docker allows to mount host directories under specified paths in the
container. The syntax is:

    docker run -v "HOST_PATH:CONTAINER_PATH" IMAGE

The directory is mounted in read-write mode. The container will be able
to read files already present inside and all written data will be stored
there and accessible in the host, even when the container is no longer
working.

For example:

-   To run PostgreSQL container with database files stored persistently
    on the host under `/data`:

        docker run -v "/data:/var/lib/postgres/data" postgres

-   To run IMAS Docker container with host's `/home/user/imasdb` as the
    pulse files database inside the container:

        docker run -v "/home/user/imasdb:/home/imas/public/imasdb" imas/ual

**Important!** The `HOST_PATH` component needs to be an absolute path.
If you want to mount a relative path, you can use shell to expand it
e.g.:

    docker run -v "$(pwd):/data" example

## IMAS Docker-related

### Do we have a list of the environment variables that are used by the 'service' actors like `ualinit`? Do we need additional (non-database) variables?

The IMAS Docker images come pre-loaded with environment variables. When
the `imas/ual` container starts, it loads `IMAS` and `uda` modules. Then
it executes `imasdb test`.

In addition, for `imas/kepler` and `imas/fc2k` the following modules are
also loaded: `Kepler`, `Keplertools` and `fc2k`. Then a local Kepler
installation named `default` is loaded.

### Do we need special structure (like `public/imasdb/jet/3/0`) or this can be whatever folder but defined as special environment variable?

The special structure is required. UAL low-level codes depend on it and
it cannot be easily changed.

When using `imas/ual` on a local computer, it is advisable to have
directories like this:

    imasdb/
    └── test
        └── 3
            └── 0
                ├── ids_10001.characteristics
                ├── ids_10001.datafile
                └── ids_10001.tree

Then you can mount it using
`-v "$(pwd)/imasdb:/home/imas/public/imasdb"`

### Can we mount the whole structure recursively (like public will point to public with all it's stucture), or do wee need to mount each level?

Directory mounting works recursively. When you have `x/y/z` directories
and you mount `x`, then all its descendants (`x/y` and `x/y/z`) will be
available.

**Important!** Take special care with symbolic links as these are not
dereferenced by Docker. If you have a symbolic link
`x/y/z -> /host/path`, then it will be seen inside the container still
as a symbolic link. When trying to read it inside container, the engine
will try to access `/host/path` in the scope of the container file
system (which is probably not what you want).

### Is it possible to run Docker on the Gateway at all?

Docker as the execution engine is not supported. You can run
[uDocker](https://github.com/indigo-dc/udocker) or
[Singularity](https://sylabs.io/singularity/). The first one almost
works like a 1-to-1 replacement of Docker. The second one has its own
container image format (but there are converters available) and a bit
different design. For example, in Singularity, your host's `$HOME` is
automatically mounted as container's `$HOME`.

...

This work has been carried out within the framework of the EUROfusion Consortium, funded by the European Union via the Euratom Research and Training Programme (Grant Agreement No. 101052200—EUROfusion). Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Commission. Neither the European Union nor the European Commission can be held responsible for them. The scientific work is published for the realization of the international project co-financed by Polish Ministry of Science and Higher Education in 2021 from financial resources of the program entitled "PMW” 5218/HEU - EURATOM/2022/2