A HEALTHCHECK instruction only sets the container's health status, visible as healthy or unhealthy in docker ps and under .State.Health in docker inspect. The Docker daemon takes no action when a container becomes unhealthy. A restart policy such as --restart unless-stopped reacts to the main process exiting, not to health status.
Confirm it by running a container whose healthcheck always exits non-zero. After the configured retries it shows (unhealthy) in docker ps and keeps running indefinitely.
Health status becomes actionable in three places: Compose can gate a dependent service on it with depends_on and condition: service_healthy, Swarm services do restart unhealthy tasks, and load balancers can read it. Under plain docker run, the application itself must exit on a failed self-check if a restart is wanted. Note also that start_period suppresses failures during startup but does not reset the retry counter after it elapses.