-
Notifications
You must be signed in to change notification settings - Fork 568
Home
- Add Docker files to the project:
- In Visual Studio right click on the project -> Add-> Docker support
- The docker-compose files are created plus the dcproj.
- Add the environment variables to the docker-compose.override by using the .env file. Containers will use docker-compose environment variables and settings overriding values at the web.config, so the needed settings must be set at the docker-compose diles and .env file. This environment variables must be caught in the application and used instead of the application settings. In our apps this is done in the CatalogConfiguration class.
- Create the docker image:
- Build the solution in Release to build the eshopmodernizedmvc image.
- When the build is done, open a Powershell prompt and execute
docker images
and in the list of images must appear eshopmodernizedmvc with tag latest
- Publish the image in the Container Registry, in this case ACR:
- Create one ACR on Azure. Take note of the address (e.g. myprivateacr.azurecr.io) and the user and password of the registry.
- Login to the container registry. From a Powershell execute
docker login -u dockerUser -p dockerPassword myprivateacr.azurecr.io
using the values of your ACR - Add to the image our ACR address as a prefix to indicate where it must be published. Execute
docker tag eshopmodernizedmvc myprivateacr.azurecr.io/eshopmodernizedmvc
to mark it for publishing in the ACR. After this if you executedocker images
this new _myprivateacr.azurecr.io/eshop/modernizedmvc must appear in the list of images. - Publish the tagged image executing
docker push myprivateacr.azurecr.io/eshopmodernizedmvc
- Note: to publish in Docker hub instead of ACR, the login step is the same (with Docker Hub credentials), and skip the tag step because by default docker will publish to Docker Hub.
- Run the image in the VM:
-
Create one VM in Azure. Select Windows Server 2016 Datacenter with containers. This way Docker is already installed and configured.
-
Copy the files docker-compose.nobuild.yml, docker-compose.override.yml and .env to the VM in a folder.
-
Edit the .env to put the IP of the VM in the variable.
-
Edit the docker-compose.nobuild file to add the prefix of your ACR eshop/modernizedmvc:
> image:myprivateacr.azurecr.io/eshop/modernizedmvc
-
If your image is in a private registry, login first. For ACR would be to execute in the VM
docker login -u dockerUser -p dockerPassword myprivateacr.azurecr.io
. -
Run
docker-compose -f .\docker-compose.nobuild.yml -f .\docker-compose.override.yml up
. The first time the images will be downloaded from the registry, so this step can take some minutes the initial execution. -
After this open the browser and write http://{ip of the VM}:5114 and the app should open.
-
- Home
- Release notes
- e-books
-
MVC & Web Forms Samples
- Tour of the "legacy" ASP.NET web apps to modernize
- How to containerize the .NET Framework web apps with Windows Containers and Docker
- Publishing your Windows Container images into a Docker Registry
- Deploying the Apps to Azure Web Apps for Containers
- Deploying the Apps to ACI (Azure Container Instances)
- Deploying your Windows Containers based app into Azure VMs (Including CI CD)
- Deploying into local Kubernetes in Windows 10 and Docker for Windows development environment
- How to deploy your Windows Containers based apps into Kubernetes in Azure Container Service (Including CI CD)
- How to add authentication authorization with Azure Active Directory
- How to migrate the SQL database to Azure with the Azure Database Migration Service
- Using Application Insights in eShopOnContainers
- N-Tier sample: WinForms app and WFC service
- ASP.NET to Azure App Service Migration Workshop