Connecting To A Docker Web App Remotely During Development

Please watch the video or read the tutorial below.

Introduction

Conveyor is a free Visual Studio extension (with the option of a standalone application if you purchase the Pro version) that provides access to your local web application projects over the LAN or internet through tunneling.

Basic setup is explained in detail here.

Usage with Docker is the same as the basic setup, however it does also require the sslPort or httpPort property to be set in launchSettings.json so that Conveyor knows where to send remote connections to.

Open launchSettings.json

You can find launchSettings.json in the Properties folder of your Docker project in Visual Studio.

Add sslPort/httpPort

Find the "Docker" section if the JSON file and add either/both sslPort and httpPort (bold below).

 {
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:45301",
      "sslPort": 44367
    }
  },
  "profiles": {
    "Conveyor_DockerWebApplication": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "https://localhost:7205;http://localhost:5205",
      "dotnetRunMessages": true
    },
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "Docker": {
      "commandName": "Docker",
      "launchBrowser": true,
      "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
      "publishAllPorts": true,
      "useSSL": true,
      "httpPort": 50505,
      "sslPort": 50506
    }
  }
}
                
                
You can randomly pick these port numbers but they do need to be unused by other services on your machine, usually you can pick something between 50000 and 65535 at random (if the service is suddenly no longer able to run, try different port numbers in case your first choice wasn't available).

Try it out

Run the Docker web application as you usually would from Visual Studio, and Conveyor should automatically map to the correct port. You can also click "Access over internet" to enable tunneling so that anyone on the internet can access the web application in your Docker container.