# how to use docker?

**URL:** https://discourse.vtk.org/t/how-to-use-docker/11138
**Category:** Web
**Created:** [April 5, 2023, 12:27pm UTC](https://discourse.vtk.org/t/how-to-use-docker/11138 "2023-04-05T12:27:20Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [May 6, 2023, 5:48pm UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/21 "2023-05-06T17:48:03Z")

</div>

We use ParaView [in that project](https://github.com/Kitware/paraview-visualizer/tree/master/docker), but that is the same gist with VTK. In fact, you can even use that ParaView to run your VTK code.

Currently we don’t provide EGL wheels of VTK (but they are WIP).

---

<div class="post-metadata">

### Author: ![phong](https://discourse.vtk.org/user_avatar/discourse.vtk.org/phong/32/6887_2.png) [@phong](https://discourse.vtk.org/u/phong)
#### Post date: [August 14, 2023, 9:56am UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/22 "2023-08-14T09:56:38Z")

</div>

Hi @Sebastien_Jourdain ,  
Can you please share where is the Dockerfile to create image kitware/trame:glvnd ? I saw the image in the dockerhub at : [Docker](https://hub.docker.com/layers/kitware/trame/glvnd_2023-08/images/sha256-69f6dc86def2621b6616bd77797db00068ee55133dc445cb8d9d6c4e6baafde3?context=explore) . However I want to know your Dockerfile which creates that image .

Thanks

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [August 14, 2023, 5:48pm UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/23 "2023-08-14T17:48:18Z")

</div>

The docker files are [captured in trame](https://github.com/Kitware/trame/tree/master/docker) and the [CI build a matrix of images](https://github.com/Kitware/trame/blob/master/.github/workflows/docker.yml).

---

<div class="post-metadata">

### Author: ![phong](https://discourse.vtk.org/user_avatar/discourse.vtk.org/phong/32/6887_2.png) [@phong](https://discourse.vtk.org/u/phong)
#### Post date: [August 15, 2023, 7:10am UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/24 "2023-08-15T07:10:13Z")

</div>

Hi Sebastien,  
I went to [https://github.com/Kitware/paraview-visualizer/tree/master/docker](https://github.com/Kitware/paraview-visualizer/tree/master/docker) to see what you did setup for EGL and GPU. I got this error, can you please help to elaborate what do I need to set it up correctly ?

```auto
~/workingspace/paraview-visualizer/docker ~/workingspace/paraview-visualizer/docker
~/workingspace/paraview-visualizer/docker
 * Restarting Apache httpd web server apache2
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
   ...done.
Starting server...
/opt/trame/activate_venv.sh: line 1: /deploy/server/venv/bin/activate: No such file or directory
/opt/trame/run.sh: line 20: /deploy/server/launcher.json: No such file or directory
Starting the wslink launcher at
/usr/bin/python: Error while finding module specification for 'wslink.launcher' (ModuleNotFoundError: No module named 'wslink')
[+] Building 0.1s (9/9) FINISHED docker:default
 => [internal] load .dockerignore 0.0s
 => => transferring context: 2B 0.0s
 => [internal] load build definition from Dockerfile 0.0s
 => => transferring dockerfile: 812B 0.0s
 => [internal] load metadata for docker.io/kitware/trame:1.2-glvnd-runtim 0.0s
 => [1/4] FROM docker.io/kitware/trame:1.2-glvnd-runtime-ubuntu20.04-py39 0.0s
 => [internal] load build context 0.0s
 => => transferring context: 258B 0.0s
 => CACHED [2/4] RUN install -d -o trame-user -g trame-user /deploy 0.0s
 => CACHED [3/4] RUN mkdir -p /opt/paraview && cd /opt/paraview && wget - 0.0s
 => CACHED [4/4] COPY --chown=trame-user:trame-user ./server /deploy/serv 0.0s
 => exporting to image 0.0s
 => => exporting layers 0.0s
 => => writing image sha256:f1fab77dfe026e4c1e200b89c0317b23b224b7a02090f 0.0s
 => => naming to docker.io/library/pv-visualizer 0.0s

```

When I run the script ./scripts/run\_image.sh, I got following error

```auto
➜ docker git:(master) ✗ docker run --rm --gpus all -p 8080:80 -v "$HOME:/data" pv-visualizer
 * Restarting Apache httpd web server apache2
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
   ...done.
Starting server...
/opt/trame/activate_venv.sh: line 1: /deploy/server/venv/bin/activate: No such file or directory
/opt/trame/run.sh: line 20: /deploy/server/launcher.json: No such file or directory
Starting the wslink launcher at
/usr/bin/python: Error while finding module specification for 'wslink.launcher' (ModuleNotFoundError: No module named 'wslink')

```

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [August 15, 2023, 4:43pm UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/25 "2023-08-15T16:43:48Z")

</div>

It seems you did not build your app `/deploy/server/venv/bin/activate: No such file or directory`.  
Or at least that step failed.

Can you explain what you did with all the steps? I might be able to spot what you skipped.

---

<div class="post-metadata">

### Author: ![phong](https://discourse.vtk.org/user_avatar/discourse.vtk.org/phong/32/6887_2.png) [@phong](https://discourse.vtk.org/u/phong)
#### Post date: [August 16, 2023, 2:57am UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/26 "2023-08-16T02:57:55Z")

</div>

Hi Sebastien,  
I did follow guide in that Git repo ([GitHub - Kitware/paraview-visualizer: Web frontend to ParaView based on trame](https://github.com/Kitware/paraview-visualizer/tree/master)) . Steps are :

1. Clone git : `git clone https://github.com/Kitware/paraview-visualizer.git`
2. Change dir into parview-visualizer/docker : `cd paraview-visualizer/docker`
3. Run script : `./scripts/build_image.sh` . I managed to build the image : pv-visualizer

> ➜ ~ docker images -a | grep pv-visualizer  
> pv-visualizer latest 4c54783983cb 18 hours ago 2.33GB

1. Run script: `./scripts/run_image.sh` . Since this script wrappers docker run so there is no error appeared in the terminal. I did run docker directly by the following command

```auto
➜ docker git:(master) ✗ docker run --rm --gpus all -p 8080:80 -v "$HOME:/data" pv-visualizer
 * Restarting Apache httpd web server apache2
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
   ...done.
Starting server...
Starting the wslink launcher at
/deploy/server/venv/bin/python: Error while finding module specification for 'wslink.launcher' (ModuleNotFoundError: No module named 'wslink')

```

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [August 16, 2023, 4:44am UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/27 "2023-08-16T04:44:30Z")

</div>

The `build_server.sh` step is failing. You need to know why.

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [August 16, 2023, 4:46am UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/28 "2023-08-16T04:46:00Z")

</div>

You may have to delete the generated `server` directory to fully re-run that step. Then report back on any log output and content of that server directory.

---

<div class="post-metadata">

### Author: ![phong](https://discourse.vtk.org/user_avatar/discourse.vtk.org/phong/32/6887_2.png) [@phong](https://discourse.vtk.org/u/phong)
#### Post date: [August 16, 2023, 4:51am UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/29 "2023-08-16T04:51:16Z")

</div>

Here is the build\_image run after I delete generated server directory

```auto
➜ docker git:(master) ✗ ./scripts/build_image.sh 
~/workingspace/paraview-visualizer/docker ~/workingspace/paraview-visualizer/docker
~/workingspace/paraview-visualizer/docker
 * Restarting Apache httpd web server apache2
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
   ...done.
Starting server...
/opt/trame/activate_venv.sh: line 1: /deploy/server/venv/bin/activate: No such file or directory
/opt/trame/run.sh: line 20: /deploy/server/launcher.json: No such file or directory
Starting the wslink launcher at
/usr/bin/python: Error while finding module specification for 'wslink.launcher' (ModuleNotFoundError: No module named 'wslink')
[+] Building 0.1s (11/11) FINISHED docker:default
 => [internal] load .dockerignore 0.0s
 => => transferring context: 2B 0.0s
 => [internal] load build definition from Dockerfile 0.0s
 => => transferring dockerfile: 742B 0.0s
 => [internal] load metadata for docker.io/kitware/trame:glvnd_2023-08 0.0s
 => [1/6] FROM docker.io/kitware/trame:glvnd_2023-08 0.0s
 => [internal] load build context 0.0s
 => => transferring context: 684B 0.0s
 => CACHED [2/6] RUN install -d -o trame-user -g trame-user /deploy 0.0s
 => CACHED [3/6] COPY --chown=trame-user:trame-user . /deploy 0.0s
 => CACHED [4/6] RUN /opt/trame/entrypoint.sh build 0.0s
 => CACHED [5/6] RUN mkdir -p /opt/paraview && cd /opt/paraview && wget -qO- https://www.paraview.org/files/v5.10/ParaView-5.10.0-egl-MPI-Linux-Python3.9-x86_64.tar.gz | tar --strip-components=1 -xzv 0.0s
 => CACHED [6/6] COPY --chown=trame-user:trame-user ./server /deploy/server 0.0s
 => exporting to image 0.0s
 => => exporting layers 0.0s
 => => writing image sha256:4c54783983cb2a2fd1cc4f90680712806942906a8018d08d1bf65cfae3197bf2 0.0s
 => => naming to docker.io/library/pv-visualizer 0.0s

```

Not sure why /deploy/server/venv/bin/activate is not mounted by the original image kitware/trame:glvnd. Here is my Dockerfile in paraview-visualizer/docker folder

```auto
➜ docker git:(master) ✗ cat Dockerfile             
FROM kitware/trame:glvnd_2023-08

# Create the /deploy directory with trame-user as the owner
RUN install -d -o trame-user -g trame-user /deploy

COPY --chown=trame-user:trame-user . /deploy

RUN /opt/trame/entrypoint.sh build

# Install ParaView-EGL
ARG PV_URL=https://www.paraview.org/files/v5.10/ParaView-5.10.0-egl-MPI-Linux-Python3.9-x86_64.tar.gz
#ARG PV_URL=https://www.paraview.org/files/nightly/ParaView-master-5.10.1-1278-g070ee00d18-egl-MPI-Linux-Python3.9-x86_64.tar.gz
RUN mkdir -p /opt/paraview && cd /opt/paraview && wget -qO- $PV_URL | tar --strip-components=1 -xzv
ENV TRAME_PARAVIEW=/opt/paraview

# Copy the server directory
COPY --chown=trame-user:trame-user ./server /deploy/server

```

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [August 16, 2023, 1:43pm UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/30 "2023-08-16T13:43:09Z")

</div>

Can you just run `build_server.sh` since that is the step that is failing. The `build_image.sh` is supposed to call that `build_server.sh` script, but from the output you are sharing, I don’t see any of that.

---

<div class="post-metadata">

### Author: ![phong](https://discourse.vtk.org/user_avatar/discourse.vtk.org/phong/32/6887_2.png) [@phong](https://discourse.vtk.org/u/phong)
#### Post date: [August 17, 2023, 12:48am UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/31 "2023-08-17T00:48:16Z")

</div>

Hi Sebastien,  
This is what build\_image.sh prints in console

```auto
➜ docker git:(master) ✗ ./scripts/build_server.sh 
~/workingspace/paraview-visualizer/docker ~/workingspace/paraview-visualizer/docker
~/workingspace/paraview-visualizer/docker
 * Restarting Apache httpd web server apache2
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
   ...done.
Starting server...
/opt/trame/activate_venv.sh: line 1: /deploy/server/venv/bin/activate: No such file or directory
/opt/trame/run.sh: line 20: /deploy/server/launcher.json: No such file or directory
Starting the wslink launcher at
/usr/bin/python: Error while finding module specification for 'wslink.launcher' (ModuleNotFoundError: No module named 'wslink')

```

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [August 18, 2023, 2:18am UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/32 "2023-08-18T02:18:13Z")

</div>

It seems that the build step is skipped probably because of the presence of the server directory from a previous failing build step. So still no information of why the build step fail(ed).

---

<div class="post-metadata">

### Author: ![phong](https://discourse.vtk.org/user_avatar/discourse.vtk.org/phong/32/6887_2.png) [@phong](https://discourse.vtk.org/u/phong)
#### Post date: [August 18, 2023, 2:22am UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/33 "2023-08-18T02:22:53Z")

</div>

Hi Sebastien,  
Thanks a lot for your carefully looking into it. No worry, I’ve managed to build my own docker app with gpu enabled. I have another question : application on server side takes a lot of RAM from GPU. When you deploy your trame app to cloud environment, how do you deal with that ? Do you consider that your trame app will blow out the GPU RAM ?

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [August 18, 2023, 2:42pm UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/34 "2023-08-18T14:42:46Z")

</div>

I guess it really depend on what you are loading and visualizing. But if you can not share a machine across users, you probably need a setup similar to JupyterHub where you start your new machine dynamically for your app. Another path could be to leverage Trame reverse websocket connection, so you could start a job “as a lambda” and have a central/static routing service. The latter is what we do when we schedule jobs on HPC.

---

<div class="post-metadata">

### Author: ![phong](https://discourse.vtk.org/user_avatar/discourse.vtk.org/phong/32/6887_2.png) [@phong](https://discourse.vtk.org/u/phong)
#### Post date: [August 21, 2023, 12:58am UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/35 "2023-08-21T00:58:05Z")

</div>

Hi Sebastien,  
My app is about loading DICOM files and viewing 3D images. I am using Trame reverse websocket. Where each connection coming in will be creating a new python job. But this way consumes a lot of memory (RAM) of GPU. Is there another way to handle it ? Or do you have any plan in the future to improve the wslink framework to handle situation like 1 single application handling multiple connections ?

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [August 21, 2023, 3:18pm UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/36 "2023-08-21T15:18:06Z")

</div>

Just to clarify, you are not using the reverse websocket. You are using the regular 1 process per user with the regular websocket. Unless you’ve create a double sided websocket proxy service.

If your data is shared across users, your would indeed be able to save memory, but otherwise, I don’t see it happening. You can create such application but you will need to make sure each client gets its own view and own name-spaced state.

Normally the 1 server for many users is supported to handle collaboration. But a good software design would allow you to manage several users independently on a single process.

---

<div class="post-metadata">

### Author: ![phong](https://discourse.vtk.org/user_avatar/discourse.vtk.org/phong/32/6887_2.png) [@phong](https://discourse.vtk.org/u/phong)
#### Post date: [August 21, 2023, 3:23pm UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/37 "2023-08-21T15:23:54Z")

</div>

Hi sebastien, can you please help to clarify what reverse websocket mean ? having an apache in the middle between user and python process does not mean reverse websocket ? Can you give me an example how do you set up reverse websocket ?

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [August 21, 2023, 7:59pm UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/38 "2023-08-21T19:59:39Z")

</div>

Reverse websocket is needed when the schedule job is not reachable (network wise) by the main web server. This setup is required on HPC (compute node vs login node) or with lambda like execution (target IP unkown). Then you need a proxy service to properly connect 2 client websocket connection together.

Are you asking me how to schedule a job on HPC and how you would make it work with trame?  
Again that is to target 1 (or more) machine(s) per user rather than 1 process per user.

Based on what you said, it seems that you want 1 process for many users.

---

<div class="post-metadata">

### Author: ![phong](https://discourse.vtk.org/user_avatar/discourse.vtk.org/phong/32/6887_2.png) [@phong](https://discourse.vtk.org/u/phong)
#### Post date: [August 22, 2023, 12:41am UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/39 "2023-08-22T00:41:31Z")

</div>

Hi Sebastien,

Yes what I want is to have 1 process for many users. I have only one dedicated server and I want to serve my 3D application for many users. Do you have any plans for doing this ?

Thanks

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [August 22, 2023, 3:15pm UTC](https://discourse.vtk.org/t/how-to-use-docker/11138/40 "2023-08-22T15:15:53Z")

</div>

Like I said, this is supported but fall onto the design of your application. Trame by default target the process isolation. If you want to break that isolation because you want to reuse loaded datasets across users, you will need to come up with an architecture that match your workflow. Since I don’t know your flow and how you aim to reuse datasets, I can’t guide you on how you could achieve that.

[Previous page](https://discourse.vtk.org/t/how-to-use-docker/11138.md?page=1)

[Next page](https://discourse.vtk.org/t/how-to-use-docker/11138.md?page=3)
