Build Image
ROS Noetic + Gazebo Classic
docker buildx build -f gazebo_classic_sim_dev.dockerfile -t sim_dev:gazebo_classic .
NOTICE
When you build code in container with error:
fatal: detected dubious ownership in repository at '/code/PX4-Autopilot'
To add an exception for this directory, call:
git config --global --add safe.directory
you should run this command in container:
git config --global --add safe.directory '*'
WSL2 With GUI&GPU Support
NOTICE: replace
~/codeon your host
docker run -it \
-v ~/code:/code \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /mnt/wslg:/mnt/wslg \
-v /usr/lib/wsl:/usr/lib/wsl \
-e DISPLAY=$DISPLAY \
-e WAYLAND_DISPLAY=$WAYLAND_DISPLAY \
-e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \
-e PULSE_SERVER=$PULSE_SERVER \
--device=/dev/dxg \
--device /dev/dri/card0 \
--device /dev/dri/renderD128 \
--gpus all sim_dev:gazebo_classic
Ubuntu With GUI&GPU Support
NOTICE: replace
~/codeon your host
docker run -it \
-v ~/code:/code \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=$DISPLAY \
--device=/dev/dxg \
--device /dev/dri/card0 \
--device /dev/dri/renderD128 \
--gpus all sim_dev:gazebo_classic
How to enter container again with bash
docker container ls -a
# start container if not
docker container start [container id]
docker exec -it [container id] bash