Skip to content

Commit f475b9f

Browse files
committed
[docs] Added description how to run task inside a docker container
1 parent c092647 commit f475b9f

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ There are two ways of interacting with AliECS:
190190
* [Hashing to aggregate](/docs/metrics.md#hashing-to-aggregate)
191191
* [Sampling reservoir](/docs/metrics.md#sampling-reservoir)
192192
* [OCC API debugging with grpcc](/docs/using_grpcc_occ.md#occ-api-debugging-with-grpcc)
193+
* [Running tasks inside docker](/docs/running_docker.md#running-task-inside-a-docker-container)
193194

194195
* Resources
195196
* T. Mrnjavac et. al, [AliECS: A New Experiment Control System for the ALICE Experiment](https://doi.org/10.1051/epjconf/202429502027), CHEP23

docs/running_docker.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Running task inside a docker container
2+
3+
> **WARNING**: This method is not meant for the production use and is meant only as a POC to test docker images as a part of existing pipeline. Right now it was tested with outdated alma8-flp-node image running readout
4+
5+
## How to
6+
7+
As a first step we need to be sure that required host computer has installed `docker`. At the time of writing this document `docker` needs to be installed manually.
8+
9+
In order to run task inside a docker image on the executor we can simply wrap the binary call into the docker image inside the [ControlWorkflow](https://github.com/AliceO2Group/ControlWorkflows) repository. For example in order to run readout we can modify `_plain_command` part of [`readout.yaml`](https://github.com/AliceO2Group/ControlWorkflows/blob/master/tasks/readout.yaml) by adding `docker run image command`. Obviously we need to have docker image that contains required binary with proper settings (creating one is outside of this document). A bit tricky part is that we need to manually (for now) specify all ENV variables with `-e` option in `docker run` call. Moreover we might need to add `--network=host` and `--ipc=host` to the call itself. Michal Tichak was able to run readout inside the alma8-flp-node as a part of workflow using following:
10+
11+
```
12+
"/usr/bin/docker run --network=host --ipc=host -v /tmp:/tmp -e O2_DETECTOR={{ detector }} -e O2_PARTITION={{ environment_id }} -e OCC_CONTROL_PORT=31000 -e O2_SYSTEM=FLP -e O2_ROLE=mtichak-ostack gitlab-registry.cern.ch/aliceo2group/dockerfiles/alma8-flp-node:latest /opt/o2/bin/o2-readout-exe"
13+
```
14+
15+
In order to figure out all of the ENV variables required one can take a look into the ECS gui environment details page and find task in question where all of the env variables are defined while running the binary outside of docker.
16+
17+
## Tips and tricks
18+
19+
Production systems run RHEL which doesn't install native `docker` by running `dnf install docker` but they are emulating the functionality by using `podman` which might behave different.
20+
21+
In order to debug whether ECS is even starting the container we can use
22+
23+
```
24+
docker ps -a
25+
```
26+
27+
This will show all of the containers which were run/are runinng on the system under current user. However there is a catch: ECS is using user `flp` so in order to figure out which container was running under this user, we need to switch the user by
28+
29+
```
30+
su - flp
31+
```
32+
33+
You can show logs directly from docker itself by using:
34+
35+
```
36+
docker logs [container-id|name]
37+
```

0 commit comments

Comments
 (0)