Running Locally on a Linux Container from Visual Studio for Mac
To deploy the eShopOnWeb sample to a local Linux Docker container, from Visual Studio for Mac, follow these step-by-step instructions:
-
Clone or download the eShopOnWeb sample to a folder on your local machine.
-
Ensure that you have installed a recent version of Docker for Mac
Note : (steps 3 and 4 have been done already for eShopOnWeb, but are included so you see how you would add support to your own projects)
-
Right click on the
Web
project in VS for Mac and select theAdd
menu thenDocker Support
. -
Select
Linux
and click onOK
. This will create a new project in your solution calleddocker-compose
. This project contains the settings for deploying to Docker. -
Open the
docker-compose.override.yml
from thedocker-compose
project and change the line that reads80
to read5106
. This is the port eShopOnWeb is configured to run on. (See theProgram.cs
file for details) -
Run the project with
Run
>Start Debugging
from the menu. -
Your default browser will start on a random port on
localhost
which is forwarded to the docker container.
Troubleshooting
The first time you run the application you may need to add a folder sharing path to Docker. Make sure you add the /usr/local/share/dotnet/sdk/NuGetFallbackFolder
folder to Docker’s file sharing options as detailed here.