You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hivemall.apache.org by my...@apache.org on 2017/06/06 07:17:49 UTC
incubator-hivemall git commit: Close #81: [HIVEMALL-84-3] Update
docker-compose.yml and documents
Repository: incubator-hivemall
Updated Branches:
refs/heads/master 1dac1a62f -> 492b5d8e7
Close #81: [HIVEMALL-84-3] Update docker-compose.yml and documents
Project: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/commit/492b5d8e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/tree/492b5d8e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/diff/492b5d8e
Branch: refs/heads/master
Commit: 492b5d8e7b218b333663c2f6ea6aed9642ab6c73
Parents: 1dac1a6
Author: Takuya Kitazawa <k....@gmail.com>
Authored: Tue Jun 6 16:17:22 2017 +0900
Committer: myui <yu...@gmail.com>
Committed: Tue Jun 6 16:17:22 2017 +0900
----------------------------------------------------------------------
docs/gitbook/docker/getting_started.md | 96 +++++++++++++++++++++++------
resources/docker/docker-compose.yml | 6 +-
2 files changed, 79 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/492b5d8e/docs/gitbook/docker/getting_started.md
----------------------------------------------------------------------
diff --git a/docs/gitbook/docker/getting_started.md b/docs/gitbook/docker/getting_started.md
index 810e5d8..d4b2991 100644
--- a/docs/gitbook/docker/getting_started.md
+++ b/docs/gitbook/docker/getting_started.md
@@ -31,38 +31,76 @@ This page introduces how to run Hivemall on Docker.
# 1. Build image
-## Build using docker-compose
+You have two options in order to build a **hivemall** docker image:
+
+## Using `docker-compose`
- `docker-compose -f resources/docker/docker-compose.yml build`
+```
+$ docker-compose -f resources/docker/docker-compose.yml build
+```
-## Build using docker command
+## Using `docker` command
- `docker build -f resources/docker/Dockerfile .`
+```
+$ docker build -f resources/docker/Dockerfile .
+```
> #### Note
-> You can [skip](./getting_started.html#running-pre-built-docker-image-in-dockerhub) building images by using existing Docker images.
+> You can [skip](./getting_started.html#running-pre-built-docker-image-in-docker-hub) building images if you try to use a pre-build docker image from Docker Hub. However, since the Docker Hub repository is experimental one, the distributed image is NOT built on the "latest" commit in [our master branch](https://github.com/apache/incubator-hivemall).
# 2. Run container
-## Run by docker-compose
+If you built an image by yourself, it can be launched by either `docker-compose` or `docker` command:
+
+## By `docker-compose`
+
+```
+$ docker-compose -f resources/docker/docker-compose.yml up -d && docker attach hivemall
+```
+
+You can edit `resources/docker/docker-compose.yml` as needed.
+
+For example, setting `volumes` options enables to mount your local directories to the container as follows:
+
+```yml
+volumes:
+ - "../../:/opt/hivemall/" # mount current hivemall dir to `/opt/hivemall` ($HIVEMALL_PATH) on the container
+ - "/path/to/data/:/root/data/" # mount resources to container-side `/root/data` directory
+```
- 1. Edit `resources/docker/docker-compose.yml`
- 2. `docker-compose -f resources/docker/docker-compose.yml up -d && docker attach hivemall`
+## By `docker` command
-## Run by docker command
+Find a local docker image by `docker images`, and hit:
- 1. Find a local docker image by `docker images`.
- 2. Run `docker run -it ${docker_image_id}`.
- Refer [Docker reference](https://docs.docker.com/engine/reference/run/) for the command detail.
+```
+$ docker run -p 8088:8088 -p 50070:50070 -p 19888:19888 -it ${docker_image_id}
+```
-## Running pre-built Docker image in Dockerhub
+Refer [Docker reference](https://docs.docker.com/engine/reference/run/) for the command detail.
- 1. Check [the latest tag](https://hub.docker.com/r/hivemall/latest/tags/) first.
- 2. Pull pre-build docker image from Dockerhub `docker pull hivemall/latest:20170517`
- 3. `docker run -p 8088:8088 -p 50070:50070 -p 19888:19888 -it hivemall/latest:20170517`
+Similarly to the `volumes` option in the `docker-compose` file, `docker run` has `--volume` (`-v`) option:
+
+```
+$ docker run ... -v /path/to/local/hivemall:/opt/hivemall
+```
+
+## Running pre-built Docker image in Docker Hub
+
+> #### Caution
+> This part is experimental. Hivemall in the pre-built image might be out-of-date compared to the latest version in [our master branch](https://github.com/apache/incubator-hivemall).
You can find pre-built Hivemall docker images in [this repository](https://hub.docker.com/r/hivemall/latest/).
+1. Check [the latest tag](https://hub.docker.com/r/hivemall/latest/tags/) first
+2. Pull pre-build docker image from Docker Hub:
+```
+$ docker pull hivemall/latest:20170517
+```
+3. Launch the pre-build image:
+```
+$ docker run -p 8088:8088 -p 50070:50070 -p 19888:19888 -it hivemall/latest:20170517
+```
+
# 3. Run Hivemall on Docker
1. Type `hive` to run (`.hiverc` automatically loads Hivemall functions)
@@ -78,10 +116,28 @@ Note that you need to expose local ports e.g., by `-p 8088:8088 -p 50070:50070 -
## Load data into HDFS (optional)
- You can find an example script to load data into HDFS in `./bin/prepare_iris.sh`.
- The script loads iris dataset into `iris` database.
+You can find an example script to load data into HDFS in `$HOME/bin/prepare_iris.sh`.
+ The script loads iris dataset into `iris` database:
+
+```
+# cd $HOME && ./bin/prepare_iris.sh
+```
+
+```
+# hive
+hive> use iris;
+hive> select * from iris_raw limit 5;
+OK
+1 Iris-setosa [5.1,3.5,1.4,0.2]
+2 Iris-setosa [4.9,3.0,1.4,0.2]
+3 Iris-setosa [4.7,3.2,1.3,0.2]
+4 Iris-setosa [4.6,3.1,1.5,0.2]
+5 Iris-setosa [5.0,3.6,1.4,0.2]
+```
+
+Once you prepared the `iris` database, you are ready to move on to [our multi-class classification tutorial](../multiclass/iris_dataset.html).
## Build Hivemall (optional)
- In the container, Hivemall resource is stored in `$HIVEMALL_PATH`.
- You can build Hivemall package by `cd $HIVEMALL_PATH && ./bin/build.sh`.
+In the container, Hivemall resource is stored in `$HIVEMALL_PATH`.
+You can build Hivemall package by `cd $HIVEMALL_PATH && ./bin/build.sh`.
http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/492b5d8e/resources/docker/docker-compose.yml
----------------------------------------------------------------------
diff --git a/resources/docker/docker-compose.yml b/resources/docker/docker-compose.yml
index efda053..5c7b594 100644
--- a/resources/docker/docker-compose.yml
+++ b/resources/docker/docker-compose.yml
@@ -5,15 +5,15 @@ services:
context: ../../
dockerfile: resources/docker/Dockerfile
args:
- - PREBUILD=false
+ - PREBUILD=true
image: hivemall
container_name: hivemall
ports:
- "8088:8088" # ResourceManager
- "19888:19888" # JobHistoryServer
- "50070:50070" # NameNode
- volumes:
- - "../../:/opt/hivemall/" # mount current hivemall dir
+ #volumes:
+ #- "../../:/opt/hivemall/" # mount current hivemall dir
#- "/path/to/data/:/root/data/" # mount resources
tty: true
stdin_open: true