Docker Image

Now a Dockerfile has been written at ROOT/docker/Dockerfile on the branch enable_docker_image.

  1. You can build a docker image by:
  1. $ docker build -t iotdb:base git://github.com/apache/incubator-iotdb#master:docker

Or:

  1. $ git clone https://github.com/apache/incubator-iotdb
  2. $ cd incubator-iotdb
  3. $ cd docker
  4. $ 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!

  1. create docker volume for data files and logs:
  1. $ docker volume create mydata
  2. $ docker volume create mylogs
  1. run a docker container:
  1. $ 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:

  1. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
  2. 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:

  1. $ docker container ls

suppose the ID is .

And get the docker IP by:

  1. $ docker inspect --format='{{.NetworkSettings.IPAddress}}' <C_ID>

suppose the IP is .

  1. If you just want to have a try by using iotdb-cli, you can:
  1. $ docker exec -it /bin/bash <C_ID>
  2. $ (now you have enter the container): /cli/sbin/start-client.sh -h localhost -p 6667 -u root -pw root

Or, run a new docker container as the client:

  1. $ docker run -it iotdb:base /cli/sbin/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:

  1. $ start-client.sh -h localhost -p 6667 -u root -pw root
  1. If you want to write codes to insert data and query data, please add the following dependence:
  1. <dependency>
  2. <groupId>org.apache.iotdb</groupId>
  3. <artifactId>iotdb-jdbc</artifactId>
  4. <version>0.9.3</version>
  5. </dependency>

Some examples about how to use IoTDB with IoTDB-JDBC can be found at: https://github.com/apache/incubator-iotdb/tree/master/example/jdbc/src/main/java/org/apache/iotdb

  1. Now enjoy it!