Skip to content

Instantly share code, notes, and snippets.

@zembutsu
Last active August 17, 2016 04:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zembutsu/7ff16e9b2c1a49cc1e9f to your computer and use it in GitHub Desktop.
Save zembutsu/7ff16e9b2c1a49cc1e9f to your computer and use it in GitHub Desktop.
参考訳:Docker ネットワーク設計哲学 ref: http://qiita.com/zembutsu/items/59463017e1e82b8c22cb
$ cat docker-compose.yml
version: "2"
services:
voting-app:
image: docker/example-voting-app-voting-app
ports:
- "80"
networks:
- votenet
result-app:
image: docker/example-voting-app-result-app
ports:
- "80"
networks:
- votenet
worker:
image: docker/example-voting-app-worker
networks:
- votenet
redis:
image: redis
networks:
- votenet
db:
image: postgres:9.4
volumes:
- "db-data:/var/lib/postgresql/data"
networks:
- votenet
volumes:
db-data:
networks:
votenet:
$ docker-compose up -d
Creating network "voteapp_votenet" with the default driver
Starting db
Starting redis
Starting voteapp_worker_1
Starting voteapp_voting-app_1
Starting voteapp_result-app_1
$ docker network inspect - voteapp_votenet
[
{
"Name": "- voteapp_votenet",
"Id": "7be1879036b217c072c824157e82403081ec60edfc4f34599674444ba01f0c57",
"Scope": "local",
"Driver": "bridge",
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.19.0.0/16",
"Gateway": "172.19.0.1/16"
}
]
},
...
...
...
]
$ docker-compose down
$ docker network create -d overlay --subnet=70.28.0.0/16 --gateway=70.28.5.254 voteapp_votenet
6d215748f300a0eda3878e76fe99e717c8ef85a87de0779e379c92af5d615b88
$ cat docker-compose.override.yml
version : "2"
networks:
votenet:
driver: overlay
ipam:
config:
- subnet: 70.28.0.0/16
gateway: 70.28.5.254
$ docker-compose up -d
Creating network "- voteapp_votenet" with driver "overlay"
Starting voteapp_worker_1
Starting redis
Starting db
Starting voteapp_voting-app_1
Starting voteapp_result-app_1
$ docker network inspect - voteapp_votenet
[
{
"Name": "- voteapp_votenet",
"Id": "b510c0affb2289548a07af7cc7e3f778987fc43812ac0603c5d01b7acf6c12be",
"Scope": "global",
"Driver": "overlay",
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "70.28.0.0/16",
"Gateway": "70.28.5.254"
}
]
},
...
...
...
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment