This is an automated email from the ASF dual-hosted git repository.

hxd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 9dfea9a  Enable docker image (#69)
9dfea9a is described below

commit 9dfea9a092556981df5b41a7dcbd5af203e6db28
Author: Xiangdong Huang <[email protected]>
AuthorDate: Sun Mar 3 09:21:36 2019 +0800

    Enable docker image (#69)
    
    * add docker/Dockerfile for building a docker image according to the master 
branch
    
    * add how to use dockerfile into the docs
---
 docker/Dockerfile                                  | 49 ++++++++++++++
 .../UserGuideV0.7.0/4-Deployment and Management.md | 79 ++++++++++++++++++++++
 2 files changed, 128 insertions(+)

diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 0000000..507e2b7
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,49 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+FROM ubuntu:18.04
+RUN apt update \
+  && apt install wget unzip lsof maven thrift-compiler=0.9.1-2.1 -y \
+  && wget 
https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz
 -O jdk11.tar.gz \
+  && tar -xzf jdk11.tar.gz \
+  && rm -rf jdk11.tar.gz \
+  && export JAVA_HOME=/jdk-11.0.2/ \
+  && export PATH="$JAVA_HOME/bin:$PATH" \
+  && wget https://github.com/apache/incubator-iotdb/archive/master.zip \
+  && unzip master.zip \
+  && rm master.zip \
+  && cd incubator-iotdb-master \
+  && mvn package -DskipTests 
-Dthrift.download-url="http://www.apache.org/licenses/LICENSE-2.0.txt"; 
-Dthrift.exec.absolute.path="/usr/bin/thrift" \
+  && cp -r iotdb/iotdb /iotdb \
+  && cp -r iotdb-cli/cli /cli \
+  && mvn clean \
+  && ls -lh ~/.m2 \
+  && rm -rf ~/.m2 \
+  && rm -rf /incubator-iotdb-master \
+  && sed -i '119d' /iotdb/conf/logback.xml \
+  && apt remove wget maven unzip thrift-compiler -y \
+  && apt autoremove -y \
+  && apt purge --auto-remove -y \
+  && apt clean -y 
+ENV JAVA_HOME  "/jdk-11.0.2"
+ENV PATH "$JAVA_HOME/bin:$PATH"
+EXPOSE 6667
+VOLUME /iotdb/data
+VOLUME /iotdb/logs
+#ENTRYPOINT ["/iotdb/bin/start-server.sh"]
diff --git a/docs/Documentation/UserGuideV0.7.0/4-Deployment and Management.md 
b/docs/Documentation/UserGuideV0.7.0/4-Deployment and Management.md
index 2cde40d..655bd89 100644
--- a/docs/Documentation/UserGuideV0.7.0/4-Deployment and Management.md 
+++ b/docs/Documentation/UserGuideV0.7.0/4-Deployment and Management.md 
@@ -26,6 +26,7 @@
         - [Prerequisites](#prerequisites)
         - [Installation from  binary files](#installation-from--binary-files)
         - [Installation from source code](#installation-from-source-code)
+        - [Installation from Docker 
(dockerfile)](#installation-by-docker-dockerfile)
     - [Configuration](#configuration)
         - [IoTDB Environment Configuration 
File](#iotdb-environment-configuration-file)
         - [IoTDB System Configuration File](#iotdb-system-configuration-file)
@@ -143,6 +144,11 @@ iotdb/     <-- root path
 +- LICENSE    <-- LICENSE
 ```
 
+### Installation by Docker (Dockerfile)
+
+You can build and run a IoTDB docker image by following the guide of 
[Deployment by Docker](#build-and-use-iotdb-by-dockerfile)
+
+
 ## Configuration
 
 
@@ -904,3 +910,76 @@ tsfile_dir = D:\\data4, E:\\data5, F:\\data6
 ```
 
 You need to move files in E:\iotdb\data\data1 to D:\data4, move files in 
%IOTDB_HOME%\data\data2 to E:\data5, move files in F:\data3 to F:\data6. In 
this way, the system will operation normally.
+
+
+
+
+## Build and use IoTDB by Dockerfile
+Now a Dockerfile has been written at ROOT/docker/Dockerfile on the branch 
enable_docker_image.
+
+1. You can build a docker image by: 
+```
+$ docker build -t iotdb:base 
git://github.com/apache/incubator-iotdb#master:docker
+```
+Or:
+```
+$ git clone https://github.com/apache/incubator-iotdb
+$ cd incubator-iotdb
+$ cd docker
+$ docker build -t iotdb:base .
+```
+Once the docker image has been built locally (the tag is iotdb:base in this 
example), you are almost done!
+
+2. create docker volume for data files and logs:
+```
+$ docker volume create mydata
+$ docker volume create mylogs
+```
+3. run a docker container:
+```shell
+$ docker run -p 6667:6667 -v mydata:/iotdb/data -v mylogs:/iotdb/logs -d 
iotdb:base /iotdb/bin/start-server.sh
+```
+If success, you can run `docker ps`, and get something like the following:
+```
+CONTAINER ID        IMAGE               COMMAND                  CREATED       
      STATUS              PORTS                               NAMES
+2a68b6944cb5        iotdb:base          "/iotdb/bin/start-se…"   4 minutes ago 
      Up 5 minutes        0.0.0.0:6667->6667/tcp              laughing_meitner
+```
+You can use the above command to get the container ID: 
+```
+$ docker container ls
+```
+suppose the ID is <C_ID>.
+
+And get the docker IP by:
+```
+$ docker inspect --format='{{.NetworkSettings.IPAddress}}' <C_ID>
+```
+suppose the IP is <C_IP>.
+
+4. If you just want to have a try by using iotdb-cli, you can:
+```
+$ docker exec -it /bin/bash  <C_ID>
+$ (now you have enter the container): /cli/bin/start-client.sh -h localhost -p 
6667 -u root -pw root
+```
+
+Or,  run a new docker container as the client:
+```
+$ docker run -it iotdb:base /cli/bin/start-client.sh -h <C_IP> -p 6667 -u root 
-pw root
+```
+Or,  if you have a iotdb-cli locally (e.g., you have compiled the source code 
by `mvn package`), and suppose your work_dir is cli/bin, then you can just run:
+```
+$ start-client.sh -h localhost -p 6667 -u root -pw root
+```
+5. If you want to write codes to insert data and query data, please add the 
following dependence:
+```xml
+        <dependency>
+            <groupId>org.apache.iotdb</groupId>
+            <artifactId>iotdb-jdbc</artifactId>
+            <version>0.8.0-SNAPSHOT</version>
+        </dependency>
+```
+Some example about how to use IoTDB with IoTDB-JDBC can be found at: 
https://github.com/apache/incubator-iotdb/tree/master/jdbc/src/test/java/org/apache/iotdb/jdbc/demo
+
+(Notice that because we have not published Apache IoTDB version 0.8.0 now, you 
have to compile the source code by `mvn install -DskipTests` to install the 
dependence into your local maven repository)
+
+6. Now enjoy it!

Reply via email to