This is a repository for creating Docker images for running and building FAST which requires OpenCL and OpenGL, and in the case of visualization; an X server.
The runtime.Dockerfile has the following build arguments:
- BASE_IMAGE - The base image to use in the Docker image. Default: ubuntu:24.04.
- FAST_VERSION - Specify FAST version, e.g. 4.14.0 or latest. Default: latest.
- OPENCL_PLATFORM - Which OpenCL platform to install. Valid options are: pocl, intel and nvidia. Default is pocl.
- TYPE - Which type of FAST image to create, must be set to either python or library. The python version creates a virtual python environment which pyfast is installed into. This environment is activated when running the image. The library version installs the FAST debian package to /opt/fast/.
- VIRTUALGL - Must be set to true or false, default is false. To render inside the docker image AND get interactive visualization, VirtualGL (VGL) has to be used.
- VGL_VERSION - VGL version to install if VIRTUALGL is enabled. Default: 3.1.4
- X_SERVER - Currently only xvfb is supported. This means that OpenGL rendering in FAST is not hardware accelerated.
Build with TYPE=library, this will install the FAST debian package to /opt/fast/
docker build . -f runtime.Dockerfile --build-arg TYPE=library -t fast-librarydocker run -ti --rm fast-library bashBuild with TYPE=python, this will create a virtual python environment in /environment and install pyfast to it. The environment is activated when the image is started.
docker build . -f runtime.Dockerfile --build-arg TYPE=python -t fast-python
docker run -ti --rm fast-python pythonOne way to get interactive visualization is give the docker container access to the host X server. In this case our docker image doesn't need a running X server, and we can build with X_SERVER=none
docker build . -f runtime.Dockerfile \
--build-arg TYPE=python \
--build-arg X_SERVER=none \
-t fast-python-pocl-no_xAlso, note that in this case, the rendering is done outside of docker container.
When running you have to give the docker container access to your X server, which is done by:
- Provide the DISPLAY environment variable which is where the window should appear. By setting it to $DISPLAY it uses your current display.
- Mount the XAUTHORITY path and set the XAUTHORITY environment variable which is needed for docker to get access to your display.
- Mount /tmp/.X11-unix/ which is where the current X11 displays are located.
Example:
docker run -it --rm \
-e DISPLAY=$DISPLAY \
-e XAUTHORITY=$XAUTHORITY \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-v $XAUTHORITY:$XAUTHORITY:ro \
fast-python-pocl-no_x \
systemCheckVirtualGL (VGL) is needed to achieve interactive visualization while rendering inside the docker. Build with VIRTUALGL=true, you also need X_SERVER=xvfb which is default:
docker build . -f runtime.Dockerfile \
--build-arg VIRTUALGL=true \
--build-arg TYPE=python \
-t fast-python-pocl-vglIn this case, VirtualGL will ensure that rendering is done using xvfb inside the docker. While the rendered image is sent to the host X server, and mouse and keyboard interactions are sent from the host X server to the xvfb server inside the docker container.
When running you have to give the docker container access to your X server, which is done by:
- Provide the DISPLAY environment variable which is where the window should appear. By setting it to $DISPLAY it uses your current display.
- Mount the XAUTHORITY path and set the XAUTHORITY environment variable which is needed for docker to get access to your display.
- Mount /tmp/.X11-unix/ which is where the current X11 displays are located.
Example:
docker run -it --rm \
-e DISPLAY=$DISPLAY \
-e XAUTHORITY=$XAUTHORITY \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-v $XAUTHORITY:$XAUTHORITY:ro \
fast-python-pocl-vgl \
systemCheckIf you have an Intel CPU with an integrated GPU (Intel Graphics) you can use the Intel OpenCL platform. Build with OPENCL_PLATFORM=intel, this will install the intel-opencl-icd package:
docker build . -f runtime.Dockerfile \
--build-arg OPENCL_PLATFORM=intel \
--build-arg TYPE=python \
-t fast-python-intelWhen running you have to add the following for docker to get access to the Intel Graphics GPU: --device=/dev/dri:
docker run -it --rm --device=/dev/dri fast-python-intel pythonSet OPENCL_PLATFORM=pocl (default):
docker build . -f runtime.Dockerfile \
--build-arg OPENCL_PLATFORM=pocl \
--build-arg TYPE=python \
-t fast-python-poclTo run:
docker run -it --rm fast-python-pocl pythonTo use NVIDIA GPUs in the docker image a different base image from NVIDIA have to be used. Build with BASE_IMAGE=nvidia/cuda:11.0.3-cudnn8-runtime-ubuntu20.04 , this base docker image is provided by NVIDIA and comes with a license, see https://hub.docker.com/r/nvidia/cuda. Also set OPENCL_PLATFORM=nvidia:
`docker build . -f runtime.Dockerfile \
--build-arg BASE_IMAGE=nvidia/cuda:11.0.3-cudnn8-runtime-ubuntu20.04 \
--build-arg OPENCL_PLATFORM=nvidia \
--build-arg TYPE=python \
-t fast-python-nvidiaWhen running you have to set --gpus all:
docker run -it --rm --gpus all fast-python-nvidia pythonSet FAST_VERSION to specific value:
docker build . -f runtime.Dockerfile \
--build-arg FAST_VERSION=4.14.0 \
--build-arg TYPE=python \
-t fast-python-intelThis docker container is for building/compiling FAST.
docker build . -f build.Dockerfile -t fast-builddocker run -it fast-build bashThe FAST docker images can be converted to an Apptainer container image by first saving it to an OCI file using docker save
and then using the apptainer build command.
# Save a FAST docker image to .tar file:
docker save fast-image -o fast-image.tar
# Convert to apptainer sif image format:
sudo apptainer build fast_image.sif docker-archive://fast-image.tar- systemCheck does not work with intel + VGL?
- xorg support for hardware accelerated rendering
- For CI testing, we need to autoclose systemCheck somehow