Description
The Docker healthcheck in the Dockerfile fails because localhost does not resolve inside the Alpine Linux container, even though the application is functioning correctly. This causes Docker Compose to mark the container as unhealthy despite the /health endpoint being accessible and working.
To Reproduce
Steps to reproduce the behavior:
- Build and run the oxicloud Docker image using Docker Compose
- Monitor the container status with
docker compose ps
- Observe that the container shows as
(unhealthy) despite the application running normally
- Execute
docker compose exec oxicloud wget -qO- http://localhost:8086/health and see "Connection refused"
- Execute
docker compose exec oxicloud wget -qO- http://127.0.0.1:8086/health and see {"status":"ok"}
Expected Behavior
The container should report as healthy since the /health endpoint responds correctly with {"status":"ok"}.
Screenshots
N/A
Environment
- OS: Ubuntu 24.04 (but affects all Alpine-based deployments)
- OxiCloud Version: Latest (diocrafts/oxicloud:latest)
- Docker Image Base: Alpine 3.23.3
- Rust Version: 1.94.1
Additional Context
The issue is specific to hostname resolution within the Alpine container. While localhost is not resolvable, 127.0.0.1 resolves correctly and the healthcheck succeeds when using the IP address directly.
Possible Solution
Change the HEALTHCHECK command in the Dockerfile from:
CMD wget -qO- http://localhost:8086/health || exit 1
to
CMD wget -qO- http://127.0.0.1:8086/health || exit 1
This uses the numeric IP address instead of the hostname, which is reliably available in all container environments.
Description
The Docker healthcheck in the Dockerfile fails because
localhostdoes not resolve inside the Alpine Linux container, even though the application is functioning correctly. This causes Docker Compose to mark the container as unhealthy despite the/healthendpoint being accessible and working.To Reproduce
Steps to reproduce the behavior:
docker compose ps(unhealthy)despite the application running normallydocker compose exec oxicloud wget -qO- http://localhost:8086/healthand see "Connection refused"docker compose exec oxicloud wget -qO- http://127.0.0.1:8086/healthand see{"status":"ok"}Expected Behavior
The container should report as healthy since the
/healthendpoint responds correctly with{"status":"ok"}.Screenshots
N/A
Environment
Additional Context
The issue is specific to hostname resolution within the Alpine container. While
localhostis not resolvable,127.0.0.1resolves correctly and the healthcheck succeeds when using the IP address directly.Possible Solution
Change the HEALTHCHECK command in the Dockerfile from:
CMD wget -qO- http://localhost:8086/health || exit 1to
CMD wget -qO- http://127.0.0.1:8086/health || exit 1This uses the numeric IP address instead of the hostname, which is reliably available in all container environments.