diff --git a/make/photon/adminserver/Dockerfile b/make/photon/adminserver/Dockerfile index df430015e..bd1c22e34 100644 --- a/make/photon/adminserver/Dockerfile +++ b/make/photon/adminserver/Dockerfile @@ -7,7 +7,7 @@ RUN tdnf erase vim -y \ && groupadd -r -g 10000 harbor && useradd --no-log-init -r -g 10000 -u 10000 harbor \ && mkdir /harbor/ COPY ./make/dev/adminserver/harbor_adminserver ./make/photon/adminserver/start.sh /harbor/ -HEALTHCHECK CMD curl -s -o /dev/null -w "%{http_code}" 127.0.0.1:8080/api/configurations|grep 401 +HEALTHCHECK CMD curl --fail -s http://127.0.0.1:8080/api/ping || exit 1 RUN chmod u+x /harbor/harbor_adminserver /harbor/start.sh WORKDIR /harbor/ diff --git a/make/photon/nginx/Dockerfile b/make/photon/nginx/Dockerfile index 3f1994db9..0670deb54 100644 --- a/make/photon/nginx/Dockerfile +++ b/make/photon/nginx/Dockerfile @@ -10,4 +10,6 @@ EXPOSE 80 VOLUME /var/cache/nginx /var/log/nginx /run STOPSIGNAL SIGQUIT +HEALTHCHECK CMD curl --fail -s http://127.0.0.1 || exit 1 + CMD ["nginx", "-g", "daemon off;"] diff --git a/make/photon/postgresql/Dockerfile b/make/photon/postgresql/Dockerfile index 451fd17e4..dab587d2b 100644 --- a/make/photon/postgresql/Dockerfile +++ b/make/photon/postgresql/Dockerfile @@ -21,8 +21,10 @@ RUN touch /etc/localtime.bak \ VOLUME /var/lib/postgresql/data ADD docker-entrypoint.sh /entrypoint.sh -RUN chmod u+x /entrypoint.sh +ADD docker-healthcheck.sh /docker-healthcheck.sh +RUN chmod u+x /entrypoint.sh /docker-healthcheck.sh ENTRYPOINT ["/entrypoint.sh"] +HEALTHCHECK CMD ["/docker-healthcheck.sh"] EXPOSE 5432 CMD ["postgres"] diff --git a/make/photon/postgresql/docker-healthcheck.sh b/make/photon/postgresql/docker-healthcheck.sh new file mode 100644 index 000000000..e680b9056 --- /dev/null +++ b/make/photon/postgresql/docker-healthcheck.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +psql -h "localhost" -U "postgres" -c 'select 1' +ret_code=$? + +if [ $ret_code != 0 ]; then + exit 1 +fi diff --git a/make/photon/ui/Dockerfile b/make/photon/ui/Dockerfile index 7300a1e15..ad32c945e 100644 --- a/make/photon/ui/Dockerfile +++ b/make/photon/ui/Dockerfile @@ -7,7 +7,7 @@ RUN tdnf distro-sync -y \ && groupadd -r -g 10000 harbor && useradd --no-log-init -r -g 10000 -u 10000 harbor \ && mkdir /harbor/ -HEALTHCHECK CMD curl -s -o /dev/null -w "%{http_code}" 127.0.0.1:8080/api/systeminfo|grep 200 +HEALTHCHECK CMD curl --fail -s http://127.0.0.1:8080/api/ping || exit 1 COPY ./make/dev/ui/harbor_ui ./src/favicon.ico ./make/photon/ui/start.sh ./UIVERSION /harbor/ COPY ./src/ui/views /harbor/views COPY ./src/ui/static /harbor/static