Getting started with ROS and Docker
## Synopsis
- Pulling ROS Images
- Running ROS containers
- Start multiple terminals on the same container
- Start multiple terminals on different containers
## Pulling ROS Images
```sh
sudo docker pull ros:kinetic-ros-core
[sudo] password for yubao:
kinetic-ros-core: Pulling from library/ros
e92ed755c008: Downloading 33.31MB/44.25MB
b9fd7cb1ff8f: Download complete
ee690f2d57a1: Download complete
53e3366ec435: Download complete
d9bc5fb3503c: Download complete
610e21ec5cdf: Download complete
80d26f628f67: Download complete
c7737f190310: Downloading 27.96MB/54.79MB
1ec575ad7946: Download complete
da84296616d7: Downloading 21.47MB/193.6MB
```
Check it:
``sudo docker images``
## Running ROS containers
```sh
sudo docker run -it ros:kinetic-ros-core
```
```sh
sudo docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bd5b3e50be78 ros:kinetic-ros-core "/ros_entrypoint.sh …" 2 minutes ago Up 2 minutes zealous_gould
```
Run roscore on it:
```sh
root@bd5b3e50be78:/# roscore
... logging to /root/.ros/log/3f633070-903b-11ea-a815-0242ac110002/roslaunch-bd5b3e50be78-37.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://bd5b3e50be78:46649/
ros_comm version 1.12.14
SUMMARY
========
PARAMETERS
* /rosdistro: kinetic
* /rosversion: 1.12.14
NODES
auto-starting new master
process[master]: started with pid [47]
ROS_MASTER_URI=http://bd5b3e50be78:11311/
setting /run_id to 3f633070-903b-11ea-a815-0242ac110002
process[rosout-1]: started with pid [60]
started core service [/rosout]
```
## Start multiple terminals on the same container
```sh
sudo docker exec -it zealous_gould bash
```
```sh
root@bd5b3e50be78:/# source /opt/ros/kinetic/setup.bash
root@bd5b3e50be78:/# rostopic list
/rosout
/rosout_agg
```
## Start multiple terminals on different containers
```sh
sudo docker run -it ros:kinetic-ros-core bash
```
## References
- [docker/Tutorials/Docker](http://wiki.ros.org/action/fullsearch/docker/Tutorials/Docker?action=fullsearch&context=180&value=linkto%3A"docker%2FTutorials%2FDocker")
No comments