Dockerizing an existing ROS project
Last updated
Last updated
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:
cp ros-project
And that's it!
This works with any supported version of ROS, just edit the top line of the Dockerfile. For example, if you want ROS Kinetic:
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.
catkin_ws
workspace mounted inside 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:
You can give your command as an argument to script/run
, for example:
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/
permission denied
error!Is it this one?
Reason: your user does not have privileges to run Docker. Put your user into the docker
group or run with sudo
.
/ros_entrypoint.sh: line 6: (...): No such file or directory
error!Instead of giving it a command like this:
Try this: