From 0fbec288584fac5a8dcc46177878cd4ed5741167 Mon Sep 17 00:00:00 2001 From: Felipe Roberto Date: Fri, 23 Sep 2016 13:49:38 -0300 Subject: [PATCH] how to use with docker --- README.md | 23 ++++++++++++++++++++++- docker/docker-compose.yml | 23 +++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 docker/docker-compose.yml diff --git a/README.md b/README.md index 3582bdb32..6c5bd35b1 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,6 @@ SeaweedFS uses HTTP REST operations to write, read, delete. The responses are in ``` > ./weed master - ``` ### Start Volume Servers ### @@ -61,8 +60,30 @@ SeaweedFS uses HTTP REST operations to write, read, delete. The responses are in ``` > weed volume -dir="/tmp/data1" -max=5 -mserver="localhost:9333" -port=8080 & > weed volume -dir="/tmp/data2" -max=10 -mserver="localhost:9333" -port=8081 & +``` + +### Running with Docker ### + +Use with docker is easy as run locally, you can pass all args like above. But you don't need to worry about "-ip". It'll be treated by the entrypoint script. ``` +docker run -p 9333:9333 --name master chrislusf/seaweedfs master +``` +``` +docker run -p 8080:8080 --name volume --link master chrislusf/seaweedfs volume -max=5 -mserver="master:9333" -port=8080 +``` +#### With Compose #### +But with Compose it's easiest. +To startup just run: +``` +docker-compose -f docker/docker-compose.yml up +``` +And to scale: +``` +docker-compose -f docker/docker-compose.yml scale volume=2 +``` +Remember that if multiple containers for volume are created on a single host, the port will clash. + ### Write File ### diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 000000000..3ccf596d5 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,23 @@ +version: '2' + +services: + master: + image: chrislusf/seaweedfs + ports: + - 9333:9333 + command: "master" + networks: + default: + aliases: + - seaweed_master + volume: + image: chrislusf/seaweedfs + ports: + - 8080:8080 + command: 'volume -max=5 -mserver="master:9333" -port=8080' + depends_on: + - master + networks: + default: + aliases: + - seaweed_volume \ No newline at end of file