This is an automated email from the ASF dual-hosted git repository.
yongzao pushed a commit to branch ain-update-docker
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/ain-update-docker by this push:
new 5331248af14 finish
5331248af14 is described below
commit 5331248af1456cee368a2913253d7008073a94f0
Author: Yongzao <[email protected]>
AuthorDate: Thu Mar 12 10:12:11 2026 +0800
finish
---
.dockerignore | 2 +
docker/ReadMe.md | 20 +++++
.../main/DockerCompose/docker-compose-ainode.yml | 3 +
...erfile-2.0.7-ainode => Dockerfile-2.0.x-ainode} | 8 +-
docker/src/main/ainode-entrypoint.sh | 24 +++---
docker/src/main/build-ainode.sh | 85 ++++++++++++++++------
6 files changed, 104 insertions(+), 38 deletions(-)
diff --git a/.dockerignore b/.dockerignore
index 288d980b3f2..ecb881d8d3d 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -20,3 +20,5 @@
*
!distribution
!docker/src/main/DockerCompose/start-1c1d.sh
+!docker/src/main/ainode-build-data/
+!docker/src/main/ainode-entrypoint.sh
\ No newline at end of file
diff --git a/docker/ReadMe.md b/docker/ReadMe.md
index 1574099c374..f674364626b 100644
--- a/docker/ReadMe.md
+++ b/docker/ReadMe.md
@@ -53,6 +53,9 @@ e.g.
./do-docker-build.sh -t standalone -v 1.0.0
# for ainode, start from 2.0.5
./do-docker-build.sh -t ainode -v 2.0.5-SNAPSHOT
+# for ainode, start from 2.0.8
+cd src/main
+./build-ainode.sh -v 2.0.8-SNAPSHOT -d /data/ainode
```
Notice:
Make directory of src/main/target and put the zip file downloading from the
official download page.
@@ -91,6 +94,23 @@ Please download `docker-compose-ainode.yml` in
`docker/src/main/DockerCompose` f
docker compose -f docker-compose-ainode.yml up -d
```
+Start from v2.0.7, run
+```shell
+docker run -d \
+ --name iotdb-ainode \
+ --network host \
+ -p 10810:10810 \
+ -p 8080:8080 \
+ -e AIN_SEED_CONFIG_NODE=127.0.0.1:10710 \
+ -e AIN_RPC_ADDRESS=127.0.0.1 \
+ -e AIN_RPC_PORT=10810 \
+ -e AIN_CLUSTER_INGRESS_ADDRESS=127.0.0.1 \
+ -e AIN_CLUSTER_INGRESS_PORT=6667 \
+ -e AIN_CLUSTER_INGRESS_USERNAME=root \
+ -e AIN_CLUSTER_INGRESS_PASSWORD=root \
+ apache/iotdb:2.0.7-SNAPSHOT-ainode
+```
+
## Quick start
We provide `docker-compose-cluster-1c1d1a.yml` in
`docker/src/main/DockerCompose`. Downloading this yaml file, both standalone
and ainode docker first. Subsequently, you can easily obtain a IoTDB cluster,
which consists of a ConfigNode, a DataNode and a AINode, in your local machine.
diff --git a/docker/src/main/DockerCompose/docker-compose-ainode.yml
b/docker/src/main/DockerCompose/docker-compose-ainode.yml
index e393d9ccffe..c61567aeca2 100644
--- a/docker/src/main/DockerCompose/docker-compose-ainode.yml
+++ b/docker/src/main/DockerCompose/docker-compose-ainode.yml
@@ -40,9 +40,12 @@ services:
- ain_cluster_ingress_username=root
- ain_cluster_ingress_password=root
- ain_cluster_ingress_time_zone=UTC+8
+ ports:
+ - "10810:10810"
volumes:
- ainode-data:/ainode/data
- ./logs/ainode:/ainode/logs
+ restart: unless-stopped
# - ./lib/ainode:/ainode/lib # Uncomment for rolling upgrade
# Note: Some environments set an extremely high container nofile limit
(~2^30 = 1073741824).
# This can make the startup step "Checking whether the ports are already
occupied..." appear to hang (lsof slow).
diff --git a/docker/src/main/Dockerfile-2.0.7-ainode
b/docker/src/main/Dockerfile-2.0.x-ainode
similarity index 91%
rename from docker/src/main/Dockerfile-2.0.7-ainode
rename to docker/src/main/Dockerfile-2.0.x-ainode
index 8e89e2a13b4..57965f6014d 100644
--- a/docker/src/main/Dockerfile-2.0.7-ainode
+++ b/docker/src/main/Dockerfile-2.0.x-ainode
@@ -38,8 +38,6 @@ RUN apt-get update && apt-get install -y
--no-install-recommends \
curl \
vim \
tzdata \
- && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
- && echo $TZ > /etc/timezone \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
@@ -57,8 +55,10 @@ RUN unzip -q apache-iotdb-${VERSION}-ainode-bin.zip \
&& mkdir -p /ainode/logs /ainode/data/ainode
# Copy data directory from build server to image
-# The build script will copy /data/ainode to tmp-data/ before build
-COPY docker/src/main/tmp-data/ /ainode/data/ainode/
+# The build script copies /data/ainode to docker/src/main/ainode-build-data/
before build
+# Note: The trailing slash is important - it copies contents not the directory
itself
+COPY docker/src/main/ainode-build-data/ /ainode/data/ainode/
+
# Set directory permissions
RUN chmod -R 755 /ainode/sbin \
diff --git a/docker/src/main/ainode-entrypoint.sh
b/docker/src/main/ainode-entrypoint.sh
index cf1fc3f19d4..bf60a6ce760 100644
--- a/docker/src/main/ainode-entrypoint.sh
+++ b/docker/src/main/ainode-entrypoint.sh
@@ -49,24 +49,24 @@ init_config() {
# Update configuration based on environment variables
# Cluster configuration
update_config "cluster_name" "${CLUSTER_NAME:-defaultCluster}"
- update_config "ain_seed_config_node" "${SEED_CONFIG_NODE:-127.0.0.1:10710}"
-
- # DataNode connection configuration
- update_config "ain_cluster_ingress_address"
"${DATA_NODE_ADDRESS:-127.0.0.1}"
- update_config "ain_cluster_ingress_port" "${DATA_NODE_PORT:-6667}"
- update_config "ain_cluster_ingress_username" "${DATA_NODE_USERNAME:-root}"
- update_config "ain_cluster_ingress_password" "${DATA_NODE_PASSWORD:-root}"
+ update_config "ain_seed_config_node"
"${AIN_SEED_CONFIG_NODE:-127.0.0.1:10710}"
# AINode service configuration
- update_config "ain_rpc_address" "${AINODE_RPC_ADDRESS:-0.0.0.0}"
- update_config "ain_rpc_port" "${AINODE_RPC_PORT:-10810}"
+ update_config "ain_rpc_address" "${AIN_RPC_ADDRESS:-0.0.0.0}"
+ update_config "ain_rpc_port" "${AIN_RPC_PORT:-10810}"
+
+ # DataNode connection configuration
+ update_config "ain_cluster_ingress_address"
"${AIN_CLUSTER_INGRESS_ADDRESS:-127.0.0.1}"
+ update_config "ain_cluster_ingress_port"
"${AIN_CLUSTER_INGRESS_PORT:-6667}"
+ update_config "ain_cluster_ingress_username"
"${AIN_CLUSTER_INGRESS_USERNAME:-root}"
+ update_config "ain_cluster_ingress_password"
"${AIN_CLUSTER_INGRESS_PASSWORD:-root}"
# Storage paths configuration
- update_config "ain_system_dir" "${SYSTEM_DIR:-data/ainode/system}"
- update_config "ain_models_dir" "${MODELS_DIR:-data/ainode/models}"
+ update_config "ain_system_dir" "${AIN_SYSTEM_DIR:-data/ainode/system}"
+ update_config "ain_models_dir" "${AIN_MODELS_DIR:-data/ainode/models}"
# Thrift compression configuration
- update_config "ain_thrift_compression_enabled" "${THRIFT_COMPRESSION:-0}"
+ update_config "ain_thrift_compression_enabled"
"${AIN_THRIFT_COMPRESSION_ENABLED:-0}"
log "Configuration initialized successfully"
}
diff --git a/docker/src/main/build-ainode.sh b/docker/src/main/build-ainode.sh
index bf95d2942ef..44a5439c54c 100644
--- a/docker/src/main/build-ainode.sh
+++ b/docker/src/main/build-ainode.sh
@@ -45,7 +45,7 @@ usage() {
Usage: $0 -v <version> [options]
Required:
- -v, --version <version> Specify IoTDB version (e.g., 1.0.0, 2.0.1)
+ -v, --version <version> Specify IoTDB version (e.g., 2.0.8)
Options:
-p, --push Push image to registry after build
@@ -56,17 +56,14 @@ Options:
-h, --help Show this help message
Examples:
- # Build version 1.0.0
- $0 -v 1.0.0
+ # Build version 2.0.8
+ $0 -v 2.0.8
# Build and push
- $0 -v 1.0.0 --push
+ $0 -v 2.0.8 --push
# Build with custom data directory
- $0 -v 1.0.0 --data-dir /mnt/data/ainode
-
- # Build for private registry
- $0 -v 2.0.1 --registry registry.example.com/apache --push
+ $0 -v 2.0.8 --data-dir /mnt/data/ainode
EOF
}
@@ -151,41 +148,75 @@ echo "============================================"
echo "Version: ${VERSION}"
echo "Distribution: ${DIST_FILE}"
echo "Data Directory: ${DATA_DIR}"
-echo "Dockerfile: ${SCRIPT_DIR}/Dockerfile-2.0.7-ainode"
+echo "Dockerfile: ${SCRIPT_DIR}/Dockerfile-2.0.x-ainode"
echo "Image Name: ${FULL_IMAGE_NAME}"
echo "Build Context: ${PROJECT_ROOT}"
+echo "Script Dir: ${SCRIPT_DIR}"
echo "============================================"
-# Prepare temporary data directory for Docker build context
-# Docker cannot COPY files from absolute paths outside build context
-TMP_DATA_DIR="${SCRIPT_DIR}/tmp-data"
-echo "Preparing data directory for build context..."
+# Prepare data directory for Docker build context
+# Use a unique name to avoid .dockerignore conflicts with common patterns like
'tmp*'
+BUILD_DATA_DIR_NAME="ainode-build-data"
+TMP_DATA_DIR="${SCRIPT_DIR}/${BUILD_DATA_DIR_NAME}"
+
+echo "Preparing data directory for build context at: ${TMP_DATA_DIR}"
-# Clean up old temp data if exists
+# Clean up old data if exists
if [ -d "$TMP_DATA_DIR" ]; then
+ echo "Cleaning up existing build data directory..."
rm -rf "$TMP_DATA_DIR"
fi
-# Copy data to temporary location within build context
+# Create directory and copy data
mkdir -p "$TMP_DATA_DIR"
-if [ -d "$DATA_DIR" ] && [ "$(ls -A $DATA_DIR)" ]; then
+if [ -d "$DATA_DIR" ] && [ "$(ls -A $DATA_DIR 2>/dev/null)" ]; then
+ echo "Copying data from ${DATA_DIR} to ${TMP_DATA_DIR}..."
cp -r "$DATA_DIR"/* "$TMP_DATA_DIR/"
- echo "Copied data from ${DATA_DIR} to ${TMP_DATA_DIR}"
+ echo "Copied $(ls -1 "$TMP_DATA_DIR" | wc -l) items"
else
- echo "No data to copy, creating empty directory"
+ echo "No data to copy, created empty directory"
+fi
+
+# Verify the directory exists and show contents
+if [ ! -d "$TMP_DATA_DIR" ]; then
+ echo "Error: Failed to create temporary data directory: ${TMP_DATA_DIR}"
+ exit 1
fi
-# Ensure cleanup on exit
+echo "Build data directory contents:"
+ls -la "$TMP_DATA_DIR" || echo "(empty directory)"
+
+# Check if .dockerignore exists and might exclude our directory
+DOCKERIGNORE_FILE="${PROJECT_ROOT}/.dockerignore"
+if [ -f "$DOCKERIGNORE_FILE" ]; then
+ if grep -q "ainode-build-data" "$DOCKERIGNORE_FILE" || grep -qE
"^\*|^tmp|^data" "$DOCKERIGNORE_FILE"; then
+ echo ""
+ echo "WARNING: .dockerignore file detected at ${DOCKERIGNORE_FILE}"
+ echo "It may exclude the '${BUILD_DATA_DIR_NAME}' directory from build
context."
+ echo "If build fails with 'COPY failed', add exception to
.dockerignore:"
+ echo " !docker/src/main/${BUILD_DATA_DIR_NAME}/"
+ echo ""
+ fi
+fi
+
+# Cleanup function
cleanup() {
- echo "Cleaning up temporary data directory..."
+ echo "Cleaning up temporary data directory: ${TMP_DATA_DIR}"
rm -rf "$TMP_DATA_DIR"
}
trap cleanup EXIT
+# Verify Dockerfile exists
+DOCKERFILE="${SCRIPT_DIR}/Dockerfile-2.0.x-ainode"
+if [ ! -f "$DOCKERFILE" ]; then
+ echo "Error: Dockerfile not found at: ${DOCKERFILE}"
+ exit 1
+fi
+
# Build Docker image
# Build context is PROJECT_ROOT (3 levels up from current script)
BUILD_CMD="docker build"
-BUILD_CMD+=" --file ${SCRIPT_DIR}/Dockerfile-2.0.7-ainode"
+BUILD_CMD+=" --file ${DOCKERFILE}"
BUILD_CMD+=" --build-arg VERSION=${VERSION}"
BUILD_CMD+=" --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
BUILD_CMD+=" --build-arg VCS_REF=$(git rev-parse --short HEAD 2>/dev/null ||
echo 'unknown')"
@@ -197,9 +228,19 @@ fi
BUILD_CMD+=" --tag ${FULL_IMAGE_NAME}"
BUILD_CMD+=" ${PROJECT_ROOT}"
-echo "Executing: ${BUILD_CMD}"
+echo ""
+echo "Executing Docker build..."
+echo "Command: ${BUILD_CMD}"
+echo ""
+
${BUILD_CMD} || {
+ echo ""
echo "Error: Docker build failed"
+ echo ""
+ echo "Troubleshooting tips:"
+ echo "1. If error is 'COPY failed: no such file or directory', check if
.dockerignore excludes 'docker/src/main/${BUILD_DATA_DIR_NAME}/'"
+ echo "2. Ensure Docker daemon is running"
+ echo "3. Try running with --no-cache option"
exit 1
}