top of page
  • Writer's pictureGowtham

No connection could be made because the target machine actively refused it. - Sitecore Docker

While attempting to install the Sitecore Docker Containers template for Next.js, I encountered the following error. Despite having installed all the necessary prerequisites for Sitecore Docker, the error persisted. Unfortunately, my internet search for a direct solution based on the error yielded no results. Consequently, I decided to address this issue by writing an article about it.


Error:

Invoke-RestMethod: D:\Playground\MyProject\up.ps1:49
Line |
  49 |  …   $status = Invoke-RestMethod "http://localhost:8079/api/http/routers …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | No connection could be made because the target machine actively refused it.
 

Solution

The error originates from the fact that the Getting Started template includes docker compose V1. To address this, we must upgrade it to V2. Please follow the instructions below for migrating to V2.

  • Make sure that the "Use Docker Compose V2" option is selected in your Docker Desktop settings. You can enable this option by navigating to Docker Desktop Settings -> General -> Use Docker Compose V2 -> Apply & restart.

use-docker-compose-v2
  • Open the up.ps1 file and locate the "docker-compose" text. Replace it with "docker compose" and then save the changes to the file.

  • Open the docker-compose.override.yml file replace the scale:0 with

    deploy:
      replicas: 0
  • Within the same file, locate the provided command and replace it with the specified alternative command.

entrypoint: powershell.exe -Command "& C:\tools\entrypoints\iis\Development.ps1"
entrypoint: powershell.exe -Command "& C:\\tools\\entrypoints\\iis\\Development.ps1"

Now execute the .\up.ps1 script, and this time, you will no longer encounter the error. Enjoy your seamless Sitecore experience!


References

147 views0 comments

Related Posts

See All

Comments


bottom of page