Skip to main content

Installation by Docker

...About 3 min

Installation by Docker

Apache IoTDB' Docker image is released on in new window
Add environments of docker to update the configurations of Apache IoTDB.

Have a try

# get IoTDB official image
docker pull apache/iotdb:1.3.0-standalone
# create docker bridge network
docker network create --driver=bridge --subnet= --gateway= iotdb
# create docker container
docker run -d --name iotdb-service \
              --hostname iotdb-service \
              --network iotdb \
              --ip \
              -p 6667:6667 \
              -e cn_internal_address=iotdb-service \
              -e cn_seed_config_node=iotdb-service:10710 \
              -e cn_internal_port=10710 \
              -e cn_consensus_port=10720 \
              -e dn_rpc_address=iotdb-service \
              -e dn_internal_address=iotdb-service \
              -e dn_seed_config_node=iotdb-service:10710 \
              -e dn_mpp_data_exchange_port=10740 \
              -e dn_schema_region_consensus_port=10750 \
              -e dn_data_region_consensus_port=10760 \
              -e dn_rpc_port=6667 \
# execute SQL
docker exec -ti iotdb-service /iotdb/sbin/ -h iotdb-service

External access:

# <IP Address/hostname> is the real IP or domain address rather than the one in docker network, could be within the computer.
$IOTDB_HOME/sbin/ -h <IP Address/hostname> -p 6667

Notice:The confignode service would fail when restarting this container if the IP Adress of the container has been changed.

# docker-compose-standalone.yml
version: "3"
    image: apache/iotdb:1.3.0-standalone
    hostname: iotdb-service
    container_name: iotdb-service
      - "6667:6667"
      - cn_internal_address=iotdb-service
      - cn_internal_port=10710
      - cn_consensus_port=10720
      - cn_seed_config_node=iotdb-service:10710
      - dn_rpc_address=iotdb-service
      - dn_internal_address=iotdb-service
      - dn_rpc_port=6667
      - dn_mpp_data_exchange_port=10740
      - dn_schema_region_consensus_port=10750
      - dn_data_region_consensus_port=10760
      - dn_seed_config_node=iotdb-service:10710
        - ./data:/iotdb/data
        - ./logs:/iotdb/logs

    external: true

If you'd like to limit the memory of IoTDB, follow these steps:

  1. Add another configuration of volumes: ./iotdb-conf:/iotdb/conf and then start the IoTDB docker container. Thus, there are some configuration files in directory of iotdb-conf.
  2. Change the memory configurations in confignode-env.shopen in new window and datanode-env.shopen in new window of iotdb-conf, and then restart the IoTDB docker container again.

deploy cluster

Until now, we support host and overlay networks but haven't supported bridge networks on multiple computers.
Overlay networks see 1C2Dopen in new window and here are the configurations and operation steps to start an IoTDB cluster with docker using host networks。

Suppose that there are three computers of iotdb-1, iotdb-2 and iotdb-3. We called them nodes.
Here is the docker-compose file of iotdb-2, as the sample:

version: "3"
    image: apache/iotdb:1.3.0-confignode
    container_name: iotdb-confignode
      - cn_internal_address=iotdb-2
      - cn_seed_config_node=iotdb-1:10710
      - cn_internal_port=10710
      - cn_consensus_port=10720
      - schema_replication_factor=3
      - schema_region_consensus_protocol_class=org.apache.iotdb.consensus.ratis.RatisConsensus
      - config_node_consensus_protocol_class=org.apache.iotdb.consensus.ratis.RatisConsensus
      - data_replication_factor=3
      - data_region_consensus_protocol_class=org.apache.iotdb.consensus.iot.IoTConsensus
      - /etc/hosts:/etc/hosts:ro
      - ./data/confignode:/iotdb/data
      - ./logs/confignode:/iotdb/logs
    network_mode: "host"

    image: apache/iotdb:1.3.0-datanode
    container_name: iotdb-datanode
      - dn_rpc_address=iotdb-2
      - dn_internal_address=iotdb-2
      - dn_seed_config_node=iotdb-1:10710
      - data_replication_factor=3
      - dn_rpc_port=6667
      - dn_mpp_data_exchange_port=10740
      - dn_schema_region_consensus_port=10750
      - dn_data_region_consensus_port=10760
      - data_region_consensus_protocol_class=org.apache.iotdb.consensus.iot.IoTConsensus
       - schema_replication_factor=3
      - schema_region_consensus_protocol_class=org.apache.iotdb.consensus.ratis.RatisConsensus
      - config_node_consensus_protocol_class=org.apache.iotdb.consensus.ratis.RatisConsensus
      - /etc/hosts:/etc/hosts:ro
      - ./data/datanode:/iotdb/data/
      - ./logs/datanode:/iotdb/logs/
    network_mode: "host"


  1. The cn_seed_config_node and dn_seed_config_node of three nodes must the same and they are the first starting node of iotdb-1 with the cn_internal_port of 10710。
  2. In this docker-compose file,iotdb-2 should be replace with the real IP or hostname of each node to generate docker compose files in the other nodes.
  3. The services would talk with each other, so they need map the /etc/hosts file or add the extra_hosts to the docker compose file.
  4. We must start the IoTDB services of iotdb-1 first at the first time of starting.
  5. Stop and remove all the IoTDB services and clean up the data and logs directories of the 3 nodes,then start the cluster again.


All configuration files are in the directory of conf.
The elements of environment in docker-compose file is the configurations of IoTDB.
If you'd changed the configurations files in conf, please map the directory of conf in docker-compose file.

log level

The conf directory contains log configuration files, namely logback-confignode.xml and logback-datanode.xml.

memory set

The conf directory contains memory configuration files, namely confignode-env.shopen in new window and datanode-env.shopen in new window. JVM heap size uses ON_HEAP_MEMORY and JVM direct memroy uses OFF_HEAP_MEMORY. e.g. ON_HEAP_MEMORY=8G, OFF_HEAP_MEMORY=2G

upgrade IoTDB

  1. Downloads the newer IoTDB docker image from docker hub
  2. Update the image of docker-compose file
  3. Stop the IoTDB docker containers with the commands of docker stop and docker rm.
  4. Start IoTDB with docker-compose -f docker-compose-standalone.yml up -d

boot automatically

  1. Add restart: always to every service of IoTDB in docker-compose file
  2. Set docker service to boot automatically
    e.g. in CentOS: systemctl enable docker

Copyright © 2024 The Apache Software Foundation.
Apache IoTDB, IoTDB, Apache, the Apache feather logo, and the Apache IoTDB project logo are either registered trademarks or trademarks of The Apache Software Foundation in all countries

Have a question? Connect with us on QQ, WeChat, or Slack. Join the community now.