From 1ef5ab3c28a9816ae7c069f9b8e4862902c53df7 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 24 Mar 2016 17:28:04 -0700 Subject: [PATCH] docker: Fix docker command entry. --- Docker.md | 10 ++++++---- Makefile | 3 ++- README.md | 6 +++--- Dockerfile => docker/Dockerfile | 6 +++--- docker/start.sh | 14 ++++++++++++++ 5 files changed, 28 insertions(+), 11 deletions(-) rename Dockerfile => docker/Dockerfile (54%) create mode 100755 docker/start.sh diff --git a/Docker.md b/Docker.md index ad7908aa7..49d5d6ca9 100644 --- a/Docker.md +++ b/Docker.md @@ -1,11 +1,13 @@ ### Run Minio docker image -```docker run -p 9000:9000 minio/minio``` -This will start minio server in the docker container, the data however is not persistent. +Start docker, however image is not persistent. + +```bash +docker run -p 9000:9000 minio/minio fs /export/data +``` -### Map data volumes from host Map export and configuration directories from host for persistence. ```bash -docker run -p 9000:9000 -v $HOME/export:/export -v $HOME/.minio:/root/.minio minio/minio +docker run -p 9000:9000 --name minio1 -v /mnt/export/minio1:/export -v /mnt/config/minio1:/root/.minio minio/minio fs /export/data ``` diff --git a/Makefile b/Makefile index 69f9e20db..ba6ffc9bc 100644 --- a/Makefile +++ b/Makefile @@ -131,7 +131,8 @@ install: gomake-all dockerimage: checkdocker verifiers $(UI_ASSETS) @echo "Building docker image:" minio:$(TAG) - @GO15VENDOREXPERIMENT=1 GOOS=linux GOARCH=amd64 go build --ldflags $(DOCKER_LDFLAGS) -o minio.dockerimage + @GO15VENDOREXPERIMENT=1 GOOS=linux GOARCH=amd64 go build --ldflags $(DOCKER_LDFLAGS) -o docker/minio.dockerimage + @cd docker @mkdir -p export @sudo docker build --rm --tag=minio/minio:$(TAG) . @rmdir export diff --git a/README.md b/README.md index 8c0795b8f..79bfe03c1 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ Minio is an object storage server compatible with Amazon S3 and licensed under [Apache license 2.0](./LICENSE). - ## Description Minio is an open source object storage server released under Apache License V2. It is compatible with Amazon S3 cloud storage service. Minio follows a minimalist design philosophy. @@ -84,11 +83,12 @@ $ make ### How to use Minio? +Initialize minio server at `~/Photos` ~~~ -$ minio init ~/Photos +$ minio init fs ~/Photos ~~~ -#### Start Minio server. +After successfully initializing, start minio server. ~~~ $ minio server diff --git a/Dockerfile b/docker/Dockerfile similarity index 54% rename from Dockerfile rename to docker/Dockerfile index 9658f4ca6..ea97892f1 100644 --- a/Dockerfile +++ b/docker/Dockerfile @@ -1,8 +1,8 @@ # use "make dockerimage" to build FROM alpine:3.3 -RUN apk add --no-cache ca-certificates +RUN apk add --no-cache ca-certificates bash ADD minio.dockerimage /minio ADD export /export EXPOSE 9000 -ENTRYPOINT ["/minio"] -CMD ["server", "/export"] +COPY start.sh /start.sh +ENTRYPOINT ["/start.sh"] diff --git a/docker/start.sh b/docker/start.sh new file mode 100755 index 000000000..373659e41 --- /dev/null +++ b/docker/start.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +if [ "$1" = 'fs' ]; then + if [ -z "$2" ]; then + echo "Invalid arguments" + echo "Usage: fs " + exit 1 + else + /bin/mkdir -p "$2" && /minio init fs "$2" && /minio server + fi +else + echo "Usage: fs " + exit 0 +fi