Docker + ROS

# run ROS container
$ docker run -it --rm -v=$(pwd):/root ros:latest

# get the name of the running ROS container
$ docker ps

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
58585321b83b        ros:latest          "/ros_entrypoint.s..."   3 minutes ago       Up 3 minutes                            admiring_lewin

# create new bash to work multi-bash env
# ROS_DOCKER_NAME = admiring_lewin
$ docker exec -it ROS_DOCKER_NAME bash
// $$ source /opt/ros/kinetic/setup.bash
$$ source /ros_entrypoint.sh

TBD

ResourceNotFound: xacro

docker run -d --name firefox -e DISPLAY=$ip:0 -v /tmp/.X11-unix:/tmp/.X11-unix jess/firefox

docker run -it --rm -e DISPLAY=$ip:0 -v=/tmp/.X11-unix:/tmp/.X11-unix -v=$(pwd):/root/.ros/ ros:latest
docker exec -it -e DISPLAY=$ip:0 modest_northcutt bash
$ printenv | grep ROS

$ source /opt/ros/kinetic/setup.bash # run this on every new shell to access to ROS commands

$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/
$ catkin_make

$ source devel/setup.bash

$ echo $ROS_PACKAGE_PATH
/home/youruser/catkin_ws/src:/opt/ros/kinetic/share
$ sudo apt-get update
$ sudo apt-get install ros-kinetic-ros-tutorials

$ rospack find roscpp
$ roscd roscpp
$ rosls roscpp_tutorials
$ cd ~/catkin_ws/src
$ catkin_create_pkg beginner_tutorials std_msgs rospy roscpp
$ cd ~/catkin_ws
$ catkin_make
$ . ~/catkin_ws/devel/setup.bash # add the workspace to your ROS environment

$ rospack depends1 beginner_tutorials
$ roscore

-- new terminal, --
$ rosnode list
$ rosnode info /rosout
$ rosrun turtlesim turtlesim_node

Last updated

Was this helpful?