Closed Doom9527 closed 4 days ago
The web container did not start after the db container started successfully. I've changed docker-compose to this:
web
db
services: web: build: . ports: - "8080:8080" environment: NEO4J_URI: bolt://db:7687 NEO4J_USERNAME: neo4j NEO4J_PASSWORD: 12345678 NEO4J_DATABASE: neo4j depends_on: db: condition: service_healthy db: image: neo4j:latest environment: NEO4J_AUTH: neo4j/12345678 NEO4JLABS_PLUGINS: "[\"apoc\"]" volumes: - neo4j-data:/data ports: - "7474:7474" - "7687:7687" healthcheck: test: ["CMD-SHELL", "curl", "--fail", "http://db:7474/db/data"] interval: 30s timeout: 10s retries: 5 volumes: neo4j-data:
It still doesn't work. By entering docker inspect --format='{{json.State. Health}}' db, I find that curl is not installed inside the neo4j container, causing the health check to fail. I solved this problem by switching to wget.
docker inspect --format='{{json.State. Health}}' db
curl
wget
healthcheck: test: wget --quiet --spider http://db:7474/db/data && echo 'Health check passed' || echo 'Health check failed' interval: 10s timeout: 3s retries: 5
The
web
container did not start after thedb
container started successfully. I've changed docker-compose to this:It still doesn't work. By entering
docker inspect --format='{{json.State. Health}}' db
, I find thatcurl
is not installed inside the neo4j container, causing the health check to fail. I solved this problem by switching towget
.Changelog
Added