1
0
mirror of https://github.com/taigrr/nats.docs synced 2025-01-18 04:03:23 -08:00

Update docker-compose doc (#126)

This commit is contained in:
Vladimir Dimitrov 2020-07-24 06:17:27 +08:00 committed by GitHub
parent ad541650ec
commit 4eeb91f35d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,29 +103,33 @@ curl http://127.0.0.1:8222/routez
It is also straightforward to create a cluster using Docker Compose. Below is a simple example that uses a network named `nats` to create a full mesh cluster.
```yaml
version: "3"
version: "3.5"
services:
nats:
image: nats
ports:
- "8222:8222"
networks: ["nats"]
nats-1:
image: nats
command: "--cluster nats://0.0.0.0:6222 --routes=nats://ruser:T0pS3cr3t@nats:6222"
networks: ["nats"]
depends_on: ["nats"]
nats-2:
image: nats
command: "--cluster nats://0.0.0.0:6222 --routes=nats://ruser:T0pS3cr3t@nats:6222"
networks: ["nats"]
depends_on: ["nats"]
networks:
default:
external:
nats:
name: nats
```
Now we use Docker Compose to create the cluster that will be using the `nats` network:
```bash
$ docker network create nats
$ docker-compose -f nats-cluster.yaml up
Recreating docs_nats_1 ... done
Recreating docs_nats-2_1 ... done