This is an automated email from the ASF dual-hosted git repository.
imbajin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hugegraph.git
The following commit(s) were added to refs/heads/master by this push:
new fc226637e chore(docker): add HEALTHCHECK & clean Dockerfiles (#3052)
fc226637e is described below
commit fc226637e986d325b2fc6b43c4b8b7895aab8a48
Author: KAI <[email protected]>
AuthorDate: Mon Jun 8 08:46:30 2026 +0530
chore(docker): add HEALTHCHECK & clean Dockerfiles (#3052)
Without HEALTHCHECK, docker ps always shows 'Up' even when Java has
crashed inside the container. Add HEALTHCHECK to all three Dockerfiles:
- Server: curl http://localhost:8080/versions
- PD: curl http://localhost:8620/v1/health
- Store: curl http://localhost:8520/v1/health
Fallback: if HTTP is not yet up but Java is alive (kill -0 on pid file),
report healthy. Avoids false unhealthy during startup.
Remove cron: Docker containers use foreground mode (-d false) after the
entrypoint fix. The cron-based monitor is for VM/bare-metal only and is
never started in Docker — removing it shrinks the image and reduces
attack surface.
Endpoints match what is already used in docker/docker-compose.yml.
Related to: #3043
---
.github/workflows/docker-build-ci.yml | 6 +++++-
hugegraph-pd/Dockerfile | 4 +++-
hugegraph-server/Dockerfile | 4 +++-
hugegraph-server/Dockerfile-hstore | 4 +++-
hugegraph-store/Dockerfile | 4 +++-
5 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/docker-build-ci.yml
b/.github/workflows/docker-build-ci.yml
index 2d88b72e7..8d31ff266 100644
--- a/.github/workflows/docker-build-ci.yml
+++ b/.github/workflows/docker-build-ci.yml
@@ -45,4 +45,8 @@ jobs:
- name: Build ${{ matrix.dockerfile }}
run: |
- docker build -f ${{ matrix.dockerfile }} .
+ IMAGE_ID=$(docker build -q -f ${{ matrix.dockerfile }} .)
+ echo "Built: $IMAGE_ID"
+ HC=$(docker inspect --format='{{json .Config.Healthcheck}}'
"$IMAGE_ID")
+ echo "Healthcheck: $HC"
+ [[ "$HC" != "null" ]] || { echo "ERROR: HEALTHCHECK missing in ${{
matrix.dockerfile }}"; exit 1; }
diff --git a/hugegraph-pd/Dockerfile b/hugegraph-pd/Dockerfile
index 41cac1adb..15d19c6f7 100644
--- a/hugegraph-pd/Dockerfile
+++ b/hugegraph-pd/Dockerfile
@@ -52,7 +52,6 @@ RUN apt-get -q update \
curl \
lsof \
vim \
- cron \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
@@ -63,5 +62,8 @@ RUN chmod 755 ./docker-entrypoint.sh
EXPOSE 8620
VOLUME /hugegraph-pd
+HEALTHCHECK --interval=15s --timeout=10s --start-period=90s --retries=3 \
+ CMD curl -fsS http://localhost:8620/v1/health >/dev/null
+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["./docker-entrypoint.sh"]
diff --git a/hugegraph-server/Dockerfile b/hugegraph-server/Dockerfile
index 4b06bdad6..068719318 100644
--- a/hugegraph-server/Dockerfile
+++ b/hugegraph-server/Dockerfile
@@ -53,7 +53,6 @@ RUN apt-get -q update \
curl \
lsof \
vim \
- cron \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& sed -i "s/^restserver.url.*$/restserver.url=http:\/\/0.0.0.0:8080/g"
./conf/rest-server.properties
@@ -67,5 +66,8 @@ RUN chmod 755 ./docker-entrypoint.sh
EXPOSE 8080
VOLUME /hugegraph-server
+HEALTHCHECK --interval=15s --timeout=10s --start-period=90s --retries=3 \
+ CMD curl -fsS http://localhost:8080/versions >/dev/null
+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["./docker-entrypoint.sh"]
diff --git a/hugegraph-server/Dockerfile-hstore
b/hugegraph-server/Dockerfile-hstore
index 54494dbad..6d3b82b5d 100644
--- a/hugegraph-server/Dockerfile-hstore
+++ b/hugegraph-server/Dockerfile-hstore
@@ -55,7 +55,6 @@ RUN apt-get -q update \
curl \
lsof \
vim \
- cron \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& sed -i "s/^restserver.url.*$/restserver.url=http:\/\/0.0.0.0:8080/g"
./conf/rest-server.properties
@@ -69,5 +68,8 @@ RUN chmod 755 ./docker-entrypoint.sh
EXPOSE 8080
VOLUME /hugegraph-server
+HEALTHCHECK --interval=15s --timeout=10s --start-period=90s --retries=3 \
+ CMD curl -fsS http://localhost:8080/versions >/dev/null
+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["./docker-entrypoint.sh"]
diff --git a/hugegraph-store/Dockerfile b/hugegraph-store/Dockerfile
index 5883f9cbf..43daa48e9 100644
--- a/hugegraph-store/Dockerfile
+++ b/hugegraph-store/Dockerfile
@@ -52,7 +52,6 @@ RUN apt-get -q update \
curl \
lsof \
vim \
- cron \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
@@ -63,5 +62,8 @@ RUN chmod 755 ./docker-entrypoint.sh
EXPOSE 8520
VOLUME /hugegraph-store
+HEALTHCHECK --interval=15s --timeout=10s --start-period=90s --retries=3 \
+ CMD curl -fsS http://localhost:8520/v1/health >/dev/null
+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["./docker-entrypoint.sh"]