Containerizing your the Simulation builds
Assuming you have followed our build for LHS instructions here, and have the binary (or the executable) ready, lets dive into how we can containerize it to run at scale.
Working with Docker
There are three prerequisites to running a Linux Headless Simulation(LHS) in a Docker container.
- Host machine must have Nvidia graphics drivers installed
- Host machine must have the Nvidia Container Toolkit installed
- The Docker container must have the Vulkan library installed.
Setting up Vulkan in a Docker Container
It is recommended to use an official Vulkan tagged Docker image from Nvidia as a base image: https://hub.docker.com/r/nvidia/vulkan/tags.
If it isn't possible to change your base image to a Vulkan image you can copy the Vulkan libraries from the official image.
Warning: When copying the Vulkan libraries from an official image make sure the OS used in the official image matches the OS on your host machine.
# Your DockerFile Here
# Setup Vulkan
COPY --from=nvidia/vulkan:1.1.121-cuda-10.1-beta.1-ubuntu18.04 /usr/local/include/vulkan /usr/local/include/vulkan
COPY --from=nvidia/vulkan:1.1.121-cuda-10.1-beta.1-ubuntu18.04 /usr/local/share/vulkan /usr/local/share/vulkan
COPY --from=nvidia/vulkan:1.1.121-cuda-10.1-beta.1-ubuntu18.04 /etc/vulkan/icd.d/nvidia_icd.json /etc/vulkan/icd.d/nvidia_icd.json
COPY --from=nvidia/vulkan:1.1.121-cuda-10.1-beta.1-ubuntu18.04 /usr/local/lib/lib* /usr/local/lib/
Running the Docker Container
When running the Vulkan enabled Docker Container the --gpus
flag must be used with docker run
to give access to the host GPU to the container.
docker run --gpus all <docker-image> <command>
How to get access?
If you have landed here without visiting our product page here, we recommend heading over there, and reaching out to our product team to get access first. Once thats completed, for any further engineering support please reach out to unitysimulationpro@unity3d.com
so we can get you set up and provide the required help.