host must be configured to allow local connections on the host machine. To do this, run xhost +local:root. To undo this run xhost -local:root.
For GPU acceleration the host computer must be using a NVIDIA graphics card and have nvidia-container-toolkit installed. nvidia-container-toolkit is available as an Ubuntu package and is on the AUR. Webots recommends using nvidia-docker2 instead, but as far as I can tell this is deprecated.
Notes:
The links on lines 27 and 60 reference files in this PR. For testing replace replace main with williamson/webots-docker.
Using docker for gui applications seems to have some fairly unpredictable problems. If the benefits of this docker image are ease-of-use and standardisation, these problems probably limit its usefulness significantly.
Build the image. There are arguments for building with different webots or ubuntu versions, but the defaults should be fine for nubots / robocup.
Run with docker run --gpus=all -it -e DISPLAY --env TEAM_NAME=nubots -v /tmp/.X11-unix:/tmp/.X11-unix:rw --network host WebotsImageName. You can add webots pathToWorldFile to run a world file directly, or leave as-is to open a bash shell.
--gpus=all enables gpu acceleration, and TEAM_NAME is for the hlvs_robocup game.json file. If you aren't running on the host network you can use --env ROBOT_HOSTS to add comma separated addresses to the hlvs whitelist.
You should be able to connect with localhost address as if webots was running normally outside a container.
Requirements:
xhost +local:root
. To undo this runxhost -local:root
.nvidia-container-toolkit
is available as an Ubuntu package and is on the AUR. Webots recommends usingnvidia-docker2
instead, but as far as I can tell this is deprecated.Notes:
main
withwilliamson/webots-docker
.Running on host network:
docker run --gpus=all -it -e DISPLAY --env TEAM_NAME=nubots -v /tmp/.X11-unix:/tmp/.X11-unix:rw --network host WebotsImageName
. You can addwebots pathToWorldFile
to run a world file directly, or leave as-is to open a bash shell.--gpus=all
enables gpu acceleration, and TEAM_NAME is for the hlvs_robocup game.json file. If you aren't running on the host network you can use --env ROBOT_HOSTS to add comma separated addresses to the hlvs whitelist.You should be able to connect with localhost address as if webots was running normally outside a container.