Deploy an ASP.NET container to a remote Docker host https://learn.microsoft.com/visualstudio/containers/hosting-web-apps-in-docker
A note about testing and deploying with orchestrators The docker-compose up and docker run commands (or running and debugging the containers in
Visual Studio) are adequate for testing containers in your development environment. But you should
not use this approach for production deployments, where you should target orchestrators like
Kubernetes
or
Service Fabric
. If you’re using Kubernetes, you have to use
pods
to organize containers
and
services
to network them. You also use
deployments
to organize pod creation and modification.
Step 6. Test your Docker application using your local Docker host This step will vary depending on what your application is doing. In a simple .NET Web application that
is deployed as a single container or service, you can access the service by opening a browser on the
Docker host and navigating to that site, as shown in Figure 5-13. (If the configuration in the Dockerfile
maps the container to a port on the host that is anything other than 80, include the host port in the
URL.)
Figure 5-13. Example of testing your Docker application locally using localhost If localhost is not pointing to the Docker host IP (by default, when using Docker CE, it should), to
navigate to your service, use the IP address of your machine’s network card.
This URL in the browser uses port 80 for the particular container example being discussed. However,
internally the requests are being redirected to port 5000, because that was how it was deployed with
the docker run command, as explained in a previous step.
You can also test the application using curl from the terminal, as shown in Figure 5-14. In a Docker
installation on Windows, the default Docker Host IP is always 10.0.75.1 in addition to your machine’s
actual IP address.
90
CHAPTER 4 | Development process for Docker-based applications
Figure 5-14. Example of testing your Docker application locally using curl