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 architecture of Docker container...
  Running command 'docker exec -i dev_cm_1 "c:\Windows\System32\cmd.exe" /c mkdir "c:\.vs-debugger"'.
Downloading debugger package...
  Command 'docker exec -i dev_cm_1 "c:\Windows\System32\curl.exe" -sSL "https://aka.ms/vs/17/release/17.10/debugger/OneCore.Msvsmon.amd64.enu.zip" -w "%{content_type}" -o "c:\.vs-debugger\OneCore.Msvsmon.amd64.enu.zip"' failed with code '0x5'.
curl: (5) Could not resolve proxy: host.docker.internal
  Command 'docker exec -i dev_cm_1 "c:\Windows\System32\curl.exe" -sSL "https://aka.ms/vs/17/release/OneCore.Msvsmon.amd64.enu.zip" -w "%{content_type}" -o "c:\.vs-debugger\OneCore.Msvsmon.amd64.enu.zip"' failed with code '0x5'.
curl: (5) Could not resolve proxy: host.docker.internal
  Failed to download the debugger in 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:

cm:
    image: ${REGISTRY}${COMPOSE_PROJECT_NAME}-xp0-cm:${VERSION:-latest}
    build:
      context: ../../docker/build/cm
      args:
        PARENT_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-cm:${SITECORE_VERSION}
        SOLUTION_IMAGE: ${REGISTRY}${COMPOSE_PROJECT_NAME}-solution:${VERSION:-latest}
        TOOLS_IMAGE: ${TOOLS_IMAGE}
        MANAGEMENT_SERVICES_IMAGE: ${MANAGEMENT_SERVICES_IMAGE}
        HEADLESS_SERVICES_IMAGE: ${HEADLESS_SERVICES_IMAGE}
        SXA_SERVICES_IMAGE: ${SXA_SERVICES_IMAGE}
        SPE_SERVICES_IMAGE: ${SPE_SERVICES_IMAGE}
    depends_on:
      - solution
    volumes:
      - ${LOCAL_DEPLOY_PATH}\platform:C:\deploy
      - ${LOCAL_DATA_PATH}\cm:C:\inetpub\wwwroot\App_Data\logs
      - ${HOST_LICENSE_FOLDER}:c:\license
    environment:
      SITECORE_LICENSE_LOCATION: c:\license\license.xml
      RENDERING_HOST_PUBLIC_URI: "https://${RENDERING_HOST}"
      ## Development Environment Optimizations
      SITECORE_DEVELOPMENT_PATCHES: DevEnvOn,CustomErrorsOff,HttpErrorsDetailed,DebugOn,DiagnosticsOff,InitMessagesOff,RobotDetectionOff
      Sitecore_AppSettings_exmEnabled:define: "no" # remove to turn on EXM
      SITECORE_JSS_EDITING_SECRET: ${JSS_EDITING_SECRET}
    entrypoint: powershell.exe -Command "& C:\tools\entrypoints\iis\Development.ps1"

At the end of this, add the following

extra_hosts:
    - "host.docker.internal:host-gateway"

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

ENV http_proxy "[http://host.docker.internal](http://host.docker.internal:8888/):<port number>"

Run the following commands in Powershell or Terminal.

cd <your project folder with docker-compose.yml files>
docker-compose down
docker-compose build cm
docker-compose up -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!