Arbejdsglæde
Arbejdsglæde

Reputation: 14088

Can't connect to a remote debugger on Docker from Visual Studio 2017

I have a Docker Composer that looks like:

    version: '2.4'

services:

  sql:
    image: sitecore-xm1-sxa-1.9.0-sqldev:9.2.0-windowsservercore-${windows_version}
    volumes:
      - .\build\data\sql:C:\Data
    mem_limit: 2GB
    ports:
      - "44010:1433"

  cd:
    image: sitecore-xm1-sxa-1.9.0-cd:9.2.0-windowsservercore-${windows_version}
    volumes:
      -  .\build\data\cd:C:\inetpub\sc\App_Data\logs
      -  .\build\Website:C:\src
      -  d:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Remote Debugger:C:\remote_debugger:ro
      -  .\src:c:\unicorn\
      -  .\docker-specific-files:c:\docker-specific-files
    ports:
      - "44002:80"
    expose:
      - "4023"
      - "4022"
      - "4021"
      - "4020"      
    links:
      - sql
    entrypoint: cmd /c "start /B powershell C:/sitecore/scripts/Watch-Directory.ps1 C:/src C:\inetpub\sc & powershell C:/sitecore/scripts/Watch-Directory.ps1 C:/docker-specific-files C:\inetpub\sc -ExcludeFiles @('Web.config','ConnectionStrings.config') & C:\\remote_debugger\\x64\\msvsmon.exe /noauth /anyuser /silent /nostatus /noclrwarn /nosecuritywarn /nofirewallwarn /nowowwarn /timeout:2147483646"

  cm:
    image: registry.valtech.dk/sitecore-xm1-sxa-1.9.0-cm:9.2.0-windowsservercore-${windows_version}
    volumes:
      -  .\build\data\cm:C:\inetpub\sc\App_Data\logs
      -  .\build\Website:C:\src
      -  .\docker-specific-files:c:\docker-specific-files
      -  .\src:c:\unicorn\
      -  d:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Remote Debugger:C:\remote_debugger:ro
    ports:
      - "44001:80"      
    expose:
      - "4023"
      - "4022"
      - "4021"
      - "4020"
    links:
      - sql
    entrypoint: cmd /c "start /B powershell C:/sitecore/scripts/Watch-Directory.ps1 C:/src C:\inetpub\sc & powershell C:/sitecore/scripts/Watch-Directory.ps1 C:/docker-specific-files C:\inetpub\sc -ExcludeFiles @('Web.config','ConnectionStrings.config') & C:\\remote_debugger\\x64\\msvsmon.exe /noauth /anyuser /silent /nostatus /noclrwarn /nosecuritywarn /nofirewallwarn /nowowwarn /timeout:2147483646" 

The Docker is working Ok, I can connect to it and see that the remote debugger is running and working.

But VS can't find any remote debugger like it is described in an article here

What am I missing, what could be an issue?

Upvotes: 2

Views: 1301

Answers (1)

Vitalii Ilchenko
Vitalii Ilchenko

Reputation: 598

Since you use remote debugger for Visual Studio 2017 you have to expose port "4022" (you can find more at MS docs: Remote Debugger Port Assignments). According to the article which you mentioned in your question you have to map ports like that:

cd:
...
  ports:
    - "44002:80"
    - "4022:4022"
...

And you can remove "expose" sections from your Docker Compose file since such ports exposing is not needed.

Upvotes: 1

Related Questions