From 3abc851e35ac8d2385135f7619d6b54d7b534a96 Mon Sep 17 00:00:00 2001 From: Cesar De la Torre Date: Sat, 6 Jan 2018 11:41:42 -0800 Subject: [PATCH] Updated 08. Setting up and Deploying eShopOnContainers to Windows Containers (markdown) --- ...eShopOnContainers-to-Windows-Containers.md | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/08.-Setting-up-and-Deploying-eShopOnContainers-to-Windows-Containers.md b/08.-Setting-up-and-Deploying-eShopOnContainers-to-Windows-Containers.md index a8dc714..b00a64e 100644 --- a/08.-Setting-up-and-Deploying-eShopOnContainers-to-Windows-Containers.md +++ b/08.-Setting-up-and-Deploying-eShopOnContainers-to-Windows-Containers.md @@ -21,7 +21,27 @@ In Windows 10 you need to set Docker to use "Windows container" instead of Linux [[/img/win-containers/enable-windows-containers.png|Enabling windows containers]] -Then right click in the Docker icon on the notification bar and select the option "Switch to Windows Containers". If you don't see this option and see the option "Switch to Linux Containers" you're already using windows containers. +Then right click in the Docker icon on the notification bar and select the option "Switch to Windows Containers". If you don't see this option and see the option "Switch to Linux Containers" you're already using Windows Containers. + +## The localhost loopback limitation + +Due to a default NAT limitation in Windows (see [https://blog.sixeyed.com/published-ports-on-windows-containers-dont-do-loopback/](https://blog.sixeyed.com/published-ports-on-windows-containers-dont-do-loopback/)) you can't access your containers using `localhost` from the host computer. + +Instead of localhost you can use either an IP address from the network card of the host or you can also use the DockerNAT IP address, that is `10.0.75.1`. If you don't have that IP when you show info with `ipconfig`, you'll need to switch to Linux Containers so it creates that Docker NAT and then go back to Windows Containers (right click on Docker icon on the task bar). + +If you use `start-windows-containers.ps1` to start the containers, that script will create environment variables with that IP for you, but if you directly use docker-compose, then you have to set the following environment variables: + +Where you see `10.75.0.1` you could also use your network card IP discovered with `ipconfig`, or a production DNS name or IP if this were a production deployment. + +* `ESHOP_EXTERNAL_DNS_NAME_OR_IP` to `10.75.0.1` +* `ESHOP_AZURE_STORAGE_CATALOG_URL` to `http://10.0.75.1:5101/api/v1/catalog/items/[0]/pic/` +* `ESHOP_AZURE_STORAGE_MARKETING_URL` to `http://10.0.75.1:5110/api/v1/campaigns/[0]/pic/` + +Note that the two last env-vars must be set only if you have not set them already because you were using Azure Storage for the images. If you are using azure storage for the images, you don't need to provide those URLs. + +Once these variables are set you can run docker-compose to start the containers and navigate to `http://10.0.75.1:5100` to view the MVC Web app. + +Using `start-windows-containers.ps1` is simpler as it'll create the env-vars for you. ## Deploy Windows Containers of eShopOnContaners Since eShopOnContainers is using Docker Multi-Stage builds, the compilation of the .NET application bits is now performed by Docker itself right before building the Docker images. @@ -94,16 +114,3 @@ If you prefer to use `docker-compose` you can do it. Just call it without the `d docker-compose -f docker-compose-windows.yml -f docker-compose.override.yml up ``` -## The localhost loopback limitation - -Due to a default NAT limitation in Windows (see [https://blog.sixeyed.com/published-ports-on-windows-containers-dont-do-loopback/](https://blog.sixeyed.com/published-ports-on-windows-containers-dont-do-loopback/)) you can't access your containers using `localhost`. - -Instead of localhost you can use the host's IP inside the DockerNAT, that is `10.0.75.1`. If you use `start-windows-containers.ps1` to start the containers the script do the needed configuration for you, but if you use docker-compose then you have to set the following environment variables: - -* `ESHOP_EXTERNAL_DNS_NAME_OR_IP` to `10.75.0.1` -* `ESHOP_AZURE_STORAGE_CATALOG_URL` to `http://10.0.75.1:5101/api/v1/catalog/items/[0]/pic/` -* `ESHOP_AZURE_STORAGE_MARKETING_URL` to `http://10.0.75.1:5110/api/v1/campaigns/[0]/pic/` - -Note that the two last must be set only if you have not set them (so, if you are not using Azure Storage for the images). If you are using azure storage for the images, you can leave them. - -Once these variables are set you can run docker-compose to start the containers and navigate to `http://10.0.75.1:5100` to view the MVC Web app. \ No newline at end of file