Lightsail container service deployment failed in CI
create-container-service-deployment starts the new container and probes its health check on the public endpoint. If the container does not become healthy, the deployment state goes to FAILED and the previous deployment stays active.
What this error means
After create-container-service-deployment, the service shows the new deployment state as FAILED and the container log shows the app exiting or the health check path returning non-2xx.
{ "deployment": { "version": 7, "state": "FAILED" } }
Container "web" failed health check on path "/" port 80.Common causes
The container does not listen on the mapped port
The public endpoint maps to a container port; if the app binds a different port or only localhost, the health check cannot reach it.
A failing health check path
The configured health check path returns a non-2xx, or the app crashes on boot due to missing environment values, so the deployment is marked FAILED.
How to fix it
Match the endpoint port and health path
- Set the public endpoint container port to the port the app binds.
- Point the health check path at a route that returns 200.
- Redeploy and confirm the deployment reaches ACTIVE.
{ "publicEndpoint": { "containerName": "web", "containerPort": 80,
"healthCheck": { "path": "/healthz", "successCodes": "200" } } }Inspect the container log
Read the container log to see startup crashes or missing configuration before retrying.
aws lightsail get-container-log \
--service-name myapp --container-name webHow to prevent it
- Expose a 200 health route and reference it in the endpoint config.
- Bind the app to the mapped container port on all interfaces.
- Provide all required environment values in the deployment.