A simple template project for dockerizing your ROS code. Have your ROS project set up and running in 3 minutes by putting your catkin workspace in catkin_ws
and running:
sudo apt-get install docker
/script/buildgui
/script/rungui-intel
The workspace consists of a mini-turtlebot example to try out:
After lauching into the container, run the following to initiate turtlebot:
cd catkin_ws
source devel/setup.bash
export TURTLEBOT3_MODEL=burger
roslaunch turtlebot3_gazebo simulation.launch
And that's it! Click on "2D Nav Goal" to assign a new target locaction for the robot.
The difference against the original ros-docker-simple?
Mostly the GUI pass through using x-server and enabling Intel graphics hardware acceleration.
This works with any supported version of ROS, just edit the top line of the Dockerfile. For example, if you want ROS Kinetic:
FROM ros:kinetic-ros-base
Yup! The catkin_ws
directory is mounted as a volume inside the container, so you can edit your code as usual, and it will be automatically synced with the container.
Inside the container, the catkin_ws
folder will be mounted at root (/catkin_ws
).
Add your dependencies to the RUN command in the Dockerfile
(this example installs tmux
and ros-kinetic-serial
packages using apt, you can add any additional commands or packages you like).
I recommend tmux as an easy way to manage multiple shells in ROS.
However, if you really want multiple terminal windows instead, you can open a new terminal window on your host computer and run:
docker exec -it ros-docker-simple /bin/bash
You can give your command as an argument to script/run
, for example:
script/run roslaunch example.launch
Edit script/run
and add the line --device=/dev/ttyUSB0 \
(changing the /dev
path to match the path to your device).
The docker-compose
tool is the standard way to run multiple containers together: https://docs.docker.com/compose/overview/
Is it this one?
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.26/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
Reason: your user does not have privileges to run Docker. Put your user into the docker
group or run with sudo
.
Instead of giving it a command like this:
script/run "cd /tmp/ && ls"
Try this:
script/run sh -c "cd /tmp/ && ls"