dockercompose build code example
Example 1: docker-compose force rebuild
docker-compose up --build
docker-compose up --force-recreate
Example 2: docker compose run
docker-compose up --build -d --remove-orphans
docker-compose -f docker-compose.yml up --build -d --remove-orphans
Example 3: healthcheck docker compose
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
interval: 1m30s
timeout: 10s
retries: 3
start_period: 40s
Example 4: docker compose entrypoint
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
interval: 1m30s
timeout: 10s
retries: 3
start_period: 40s