The LGDXRobot2 ROS 2 Docker image allows all dependencies to be deployed in one go, but it does not include Webots. Running Webots inside Docker may be slow. Fortunately, Webots is flexible and can operate with the simulation over the network.

  1. Create a folder for sharing Webots files
mkdir -p ~/webots_share
  1. Start the Docker container and mount the shared folder
docker run -d  \
  --name lgdxrobot2 \
  -e PUID=1000 \
  -e PGID=1000 \
  -v ~/webots_share:/config/webots_share \
  -p 3000:3000 \
  -p 3001:3001 yukaitung/lgdxrobot2-desktop:latest
  1. Set environment variables inside the container
export WEBOTS_SHARED_FOLDER=~/webots_share:/config/webots_share
  1. Save the local simulation server script on the host machine.
  2. Define WEBOTS_HOME and run the local simulation server on the host machine.
python3 <path>/local_simulation_server.py
  1. Run the simulation in the container. When the simulation is run in the container, the Webots GUI opens automatically on the host machine.