Hi,
This is the first time I try to use AWS Lightsail. I use it in us-east-1
. I setup a nano single instance and try to run two containers - one with a Go program which talks to a database and one with Nginx front-end serving a React application.
For the sake of troubleshooting, I narrowed it down to just the Go program.
The Docker image I created on my laptop runs fine on my laptop, it can even open the connection to the database (I made the database public while debugging).
But when I push the image to Lightsail and try to deploy it, all I get is:
[1/Jan/2022:01:03:21] [deployment:8] Creating your deployment
[1/Jan/2022:01:04:31] [deployment:8] Started 1 new node
[1/Jan/2022:01:05:25] [deployment:8] Started 1 new node
[1/Jan/2022:01:06:34] [deployment:8] Started 1 new node
[1/Jan/2022:01:07:12] [deployment:8] Canceled
No matter what I try.
The container's ENTRYPOINT script prints some output (for instance, it executes env
to show the environment), but I don't see it in the logs and the Go code is verbose when it starts up but I don't see the expected output in the logs either.
It also starts in about 5 seconds, including opening the connection to the database and running a few quick transactions on it, so I don't think it's a matter of slow start.
I couldn't find any other output or logs from Lightsail. The container takes about 3Mb of RAM when it runs on my laptop, way less than the 512Mb available on the Nano instance.
Similar issues happen with the container which runs Nginx. It's a custom container based on the official nginx:alpine
image with my static files and extra config added to it. It runs fine on my laptop.
What am I doing wrong? Where else can I look for hints on why my deployments fail? I've been banging my head over this for three days now.
Another thing to consider is your healthcheck settings. Some containers take longer than the default settings to become healthy. You can adjust your healthcheck settings when you create a deployment. https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_ContainerServiceHealthCheckConfig.html