Update for version 2 of docker-compose

This commit is contained in:
Akshat Agarwal 2016-06-17 12:38:15 -07:00 committed by GitHub
parent dbbe9aed27
commit 89c384b286
1 changed files with 27 additions and 25 deletions

View File

@ -180,39 +180,41 @@ Now that you have an appreciation for bootstrapping a distributed ROS example ma
> Start by making a folder named `rostutorials` and moving the Dockerfile we used earlier inside this directory. Then create a yaml file named `docker-compose.yml` in the same directory and paste the following inside: > Start by making a folder named `rostutorials` and moving the Dockerfile we used earlier inside this directory. Then create a yaml file named `docker-compose.yml` in the same directory and paste the following inside:
```yaml ```yaml
master: version: '2'
build: . services:
container_name: master master:
command: build: .
- roscore container_name: master
command:
talker: - roscore
build: .
container_name: talker talker:
environment: build: .
- "ROS_HOSTNAME=talker" container_name: talker
- "ROS_MASTER_URI=http://master:11311" environment:
command: rosrun roscpp_tutorials talker - "ROS_HOSTNAME=talker"
- "ROS_MASTER_URI=http://master:11311"
listener: command: rosrun roscpp_tutorials talker
build: .
container_name: listener listener:
environment: build: .
- "ROS_HOSTNAME=listener" container_name: listener
- "ROS_MASTER_URI=http://master:11311" environment:
command: rosrun roscpp_tutorials listener - "ROS_HOSTNAME=listener"
- "ROS_MASTER_URI=http://master:11311"
command: rosrun roscpp_tutorials listener
``` ```
> Now from inside the same folder, use docker-copose to launch our ROS nodes and specify that they coexist on their own network: > Now from inside the same folder, use docker-copose to launch our ROS nodes and specify that they coexist on their own network:
```console ```console
$ docker-compose --x-networking up -d $ docker-compose up -d
``` ```
> Notice that a new network named `rostutorials` has now been created, you can inspect it further with: > Notice that a new network named `rostutorials_default` has now been created, you can inspect it further with:
```console ```console
$ docker network inspect rostutorials $ docker network inspect rostutorials_default
``` ```
> We can monitor the logged output of each service, such as the listener node like so: > We can monitor the logged output of each service, such as the listener node like so:
@ -228,7 +230,7 @@ $ docker-compose stop
$ docker-compose rm $ docker-compose rm
``` ```
> Note: the auto-generated network, `rostutorials`, will persist over the life of the docker engine or until you explicitly remove it using [`docker network rm`](https://docs.docker.com/engine/reference/commandline/network_rm/)\. > Note: the auto-generated network, `rostutorials_default`, will persist over the life of the docker engine or until you explicitly remove it using [`docker network rm`](https://docs.docker.com/engine/reference/commandline/network_rm/)\.
# More Resources # More Resources