In directory where the Dockerfile
is located, run
docker build -t mm8803/fetch:latest .
The image will install everything you need to run the Fetch robot in Gazebo.
docker run -it \
--user=$(id -u) \
--env="DISPLAY" \
--workdir="/home/$USER" \
--volume="/home/$USER:/home/$USER" \
--volume="/etc/group:/etc/group:ro" \
--volume="/etc/passwd:/etc/passwd:ro" \
--volume="/etc/shadow:/etc/shadow:ro" \
--volume="/etc/sudoers.d:/etc/sudoers.d:ro" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
--env QT_X11_NO_MITSHM=1 \
mm8803/fetch:latest \
rqt
To open a new terminal in the container, we first need the container ID:
docker ps
Get the container ID that matches the image name we set previously. Let's assume the container ID is 1e275acd4d98
(this was the ID on my machine at the time of writing).
docker exec -it 1e275acd4d98 bash
And you should have a new terminal to run commands in.
Since we exec into a brand new shell, we'll have to source the ROS setup.bash
file so that we get access to all the ROS niceness (aka autocomplete).
Just run source /opt/ros/$ROS_DISTRO/setup.bash
and you should be good to go.
Thanks to Ruffin White (previously at Georgia Tech, now at UCSD) for writing up a great tutorial on using the GUI with docker for ROS.