Reading time: 3 min read

Fixing a Failed Debugger Download for Sitecore and Docker Containers

A fix for “Could not resolve proxy error” when trying to debug containers in Sitecore

Portrait photo of Gorman Law, article author

How To Debug Sitecore When Using Docker

If you’re looking for how to attach to a process when using docker, please check out these other guides:

This blog goes over how to fix an issue that occurs when trying to download the debugging package.

What The Error Looks Like

Screenshot of the 'Attach to Process' dialog box, a common developer tool for debugging.

When changing your connection target to your desired target (usually cm_1), Visual Studio will try to download a debugger. If it fails, check the Output window and change it to show Debug logs; you might see the following:

Determining ,[object Object], ,[object Object], Docker container...
  Running command ,[object Object], exec -i dev_cm_1 ,[object Object], /c mkdir ,[object Object],'.
Downloading debugger ,[object Object],...
  Command ,[object Object], exec -i dev_cm_1 ,[object Object], -sSL ,[object Object], -w ,[object Object], -o ,[object Object],' failed ,[object Object], code ',[object Object],x5'.
curl: (,[object Object],) Could ,[object Object], resolve proxy: host.docker.internal
  Command ,[object Object], exec -i dev_cm_1 ,[object Object], -sSL ,[object Object], -w ,[object Object], -o ,[object Object],' failed ,[object Object], code ',[object Object],x5'.
curl: (,[object Object],) Could ,[object Object], resolve proxy: host.docker.internal
  Failed ,[object Object], download the debugger ,[object Object], the Docker container.

How To Fix The Error

Go to your docker-compose.override.yml or docker-compose.yml and look for the container you’re trying to debug. In our example, we’re looking for dev_cm_1 which is just cm. Mine looks something like this:

[object Object],
,[object Object], ${REGISTRY}${COMPOSE_PROJECT_NAME}-xp0-cm:${VERSION:-latest}
,[object Object],
,[object Object], ../..,[object Object],build/cm
,[object Object],
,[object Object], ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-cm:${SITECORE_VERSION}
,[object Object], ${REGISTRY}${COMPOSE_PROJECT_NAME}-solution:${VERSION:-latest}
,[object Object], ${TOOLS_IMAGE}
,[object Object], ${MANAGEMENT_SERVICES_IMAGE}
,[object Object], ${HEADLESS_SERVICES_IMAGE}
,[object Object], ${SXA_SERVICES_IMAGE}
,[object Object], ${SPE_SERVICES_IMAGE}
,[object Object],
      - solution
,[object Object],
      - ${LOCAL_DEPLOY_PATH}\platform:C:\deploy
      - ${LOCAL_DATA_PATH}\cm:C:\inetpub\wwwroot\App_Data\logs
      - ${HOST_LICENSE_FOLDER}:c:\license
,[object Object],
,[object Object], c:\license\license.xml
,[object Object], ,[object Object],
      ,[object Object],
,[object Object], DevEnvOn,CustomErrorsOff,HttpErrorsDetailed,DebugOn,DiagnosticsOff,InitMessagesOff,RobotDetectionOff
,[object Object],define: ,[object Object], ,[object Object],
,[object Object], ${JSS_EDITING_SECRET}
,[object Object], powershell.exe -Command ,[object Object],

At the end of this, add the following

[object Object],:
    ,[object Object], ",[object Object],[object Object],[object Object],[object Object],

Next, go to your Dockerfile and delete anything that looks like this:

ENV http_proxy "[,[object Object],](,[object Object],):,[object Object],"

Run the following commands in Powershell or Terminal.

[object Object], <your project folder with docker-compose.yml ,[object Object],>
docker-compose down
docker-compose build ,[object Object],
docker-compose ,[object Object], -d

You should now be able to change the Connection target to your desired debugging target.

The Fix Resolved

This blog teaches you how to fix a Could not resolve proxy error when trying to debug a Docker container that runs Sitecore. Happy debugging!