Slow mssql-init process


I forgot to mention an issue I ran into when spinning up images for my last post. It seems the mssql-init container can timeout and cause your docker-compose up command to abort. Here’s how I dealt with that.

When I first tried to spin up the XP0 topology in my quickstart repo, I got the following error:

ERROR: for id Container "98f3676706cf" is unhealthy.

ERROR: for cm Container "98f3676706cf" is unhealthy.
ERROR: Encountered errors while bringing up the project.

The container id was for mssql-init, which I found by running docker container ls -a. When I looked at the logs for that container, I didn’t see any errors or anything. I ran docker-compose up -d again and it was successful. So it seems that there wasn’t really any error, it’s just that installing all those dacpacs was taking too long.

Looking at the docker-compose.yml file I saw that there was configuration for a healthcheck and it included a start-period setting of 300s. 5 minutes is how long the mssql-init image ran before the error showed up, so I figured I could try extending that start period.

I added the setting to my docker-compose.override.yml (see line 38) and increased it until I no longer got the error when spinning up the containers from a clean state. I landed on 420s for XP0 with SXA and Headless Services. I expect that the time needed depends a fair amount on the specs of your machine. I have a fair amount of RAM on mine, but it is getting rather old. (YMMV)

There is also an environment variable named POST_DEPLOYMENT_WAIT_PERIOD that I initially thought was related to this since they were both set to 300. However, it seems that this is actually controls how long the container sleeps after the init scripts are done before the container exits. I’m not really sure what the point is or why it would need to sit around for 5 minutes after its done with its work. I decreased the value to 120 and everything seems to still work fine. ¯\_(ツ)_/¯