diff --git a/Dockerfile b/Dockerfile
index ab826705..40a91a06 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,10 +1,14 @@
 FROM alpine:latest
 RUN apk --update add ca-certificates \
                      mailcap \
-                     curl
+                     curl \
+                     jq
+
+COPY healthcheck.sh /healthcheck.sh
+RUN chmod +x /healthcheck.sh  # Make the script executable
 
 HEALTHCHECK --start-period=2s --interval=5s --timeout=3s \
-  CMD curl -f http://localhost/health || exit 1
+    CMD /healthcheck.sh || exit 1
 
 VOLUME /srv
 EXPOSE 80
diff --git a/healthcheck.sh b/healthcheck.sh
new file mode 100644
index 00000000..43eb2176
--- /dev/null
+++ b/healthcheck.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+PORT=$(jq .port /.filebrowser.json)
+curl -f http://localhost:$PORT/health || exit 1