Skip to content

05. Running locally on a Windows Container from Visual Studio

Sarah Dutkiewicz edited this page Feb 7, 2025 · 1 revision

To deploy the eShopOnWeb sample to a local Windows Docker container from Visual Studio, follow these step-by-step instructions:

  1. Clone or download the eShopOnWeb sample to a folder on your local machine.

  2. Ensure the computer on which you're running has Windows containers enabled. You can read how perform the one-time setup on the Docker Blog

  3. Right click on the Web project in Visual Studio and select the Add menu then Docker Support.

    image

  4. Select Windows and click on OK. This will create a new project in your solution called docker-compose. This project contains the settings for deploying to Docker.

    image

  5. Open the docker-compose.override.yml from the docker-compose project and change the line that reads 80 to read 5106. This is the port eShopOnWeb is configured to run on. (See the Program.cs file for details)

    image

  6. Press F5 to run the project or select Debug > Start Debugging from the menu.

  7. Your default browser will start on a random port of the IP address which is forwarded to the docker container.

    image

Troubleshooting

You may encounter an error if your Docker for Windows is configured to run Linux containers. This setting may be changed by right clicking on the tray icon and selecting Switch to Windows containers

image