Fix for Service context deadline exceeded issue while docker-compose up for Sitecore 10

Fore-note: Out of my experience, the minimum configuration for Commerce installation (on Docker) is 32 GB RAM D8s v3 (8 vcpus, 32 GiB memory).  I wouldn't even try the installation in a 16 GB RAM machine since the time-out effect is more pronounced in that configuration. This blog is written based on D8s v3 (8 vcpus, 32 GiB memory) VM.

One of the nagging errors I've been encountering when I execute docker-compose up -d is a race condition when some services don't process on-time and finally time-out: a kind of  service steam-out scenario.  This issue used to happen for Sitecore 10 installed on Docker and now for Sitecore 10 Commerce installed on Docker. You should usually get this error (on any random service) right on your first run of xc0 docker-compose up or, if services are up and running:

1. Execute docker-compose down 

2. And then,  try to docker-compose up with or without deleting the folders under c:\containers. 

Then, an error on one of the waiting services is thrown after a long wait -

ERROR: for xc0_engine-ops_1  Cannot start service engine-ops: container b970a57e5a904b00e3a3b32891f9c96017d73fa301b68cbf9d397fe28c125f75 encountered an error during hcsshim::System::Start: context deadline exceeded

ERROR: for engine-ops  Cannot start service engine-ops: container b970a57e5a904b00e3a3b32891f9c96017d73fa301b68cbf9d397fe28c125f75 encountered an error during hcsshim::System::Start: context deadline exceeded

ERROR: Encountered errors while bringing up the project.

Solution:

I found that there is a WAIT_HOSTS option where you can add the list of services that the concerned service depends on in the docker-compose.yml.  This is added in the docker compose file within the environment section and this helps with fixing the issue. I plan to raise a Sitecore ticket but happy that I can use this for now since its a one-time change to my docker compose file. I've added this for  xdbsearchworker, xconnect and xdbautomationworker services only. This fix has been good for me so far and my xc0 docker-compose up has higher success rate. However, when I have both xc0 and xp0 running in the same machine on docker, the time-out issue happens for xc0 topology. I'm yet to find the actual cause for the same although I suspect port conflicts. However, this fix works for me when I just have xc0 topology on docker, have been able to docker-compose up and down without any issues.

xdbsearchworker service:

SQL port is 14330 and not 14430 as highlighted above.

xconnect service:

SQL port is 14330 and not 14430 as highlighted above.

xdbautomation service:

SQL port is 14330 and not 14430 as highlighted above.

Updated Commerce Docker Compose File

Reference: https://www.datanovia.com/en/courses/docker-compose-wait-for-dependencies/

Comments

Popular Posts