Container only works while running from Visual Studio - visual-studio

I have got the sample WeatherForecast API in VS 2019 with Docker support. I build the solution and run it with Docker profile. I can see the image gets created in Docker Desktop, container is running and I can access the https://localhost:49181/weatherforecast URL.
But as soon as I stop running the solution from VS, that URL becomes inaccessible.
Any ideas what could be happening? Shouldn't I be able to access the API/URL once it's deployed in Docker and VS is not running?
Container is running even when VS has stopped

Related

Deploying Docker containers to Windows server

There a lot of stuff regarding dockerizing apps in Visual Studio.I successfully managed to create ,run and debug my net.core app in Visual studio using local docker desktop ,wsl2 and kubernetes systems.
But it totally unclear how my app can be deployed to Windows server ,except azure deployment. How can I set in my visual studio or Windows terminal servers docker and kubernetes server instead of my local ?Just can't find any worth tutorials.
Thanks for help.

Unable to access api running in docker from host machine but works while debugging with VS2019

I am trying to run a docker container on my windows 10 machine using docker for desktop.
I am using sdk:3.1-alpine AS my base image.
My docker file is the default file generated by VS 2019 and my API is the default controller generated by VS2019 with dotnetcore 3.1.
What I see that I am able to access the API running in my docker container from host machine only when I am debugging using Visual studio, however as soon as I stop debugging I am not able to access the API anymore even though the docker container is still running.
What do I need to do to access my API without debugging it using VS2019.
I was hitting the http port whereas by default https redirection was enabled. However the redirection doesnt work from container.

Visual studio container debugging with a remote docker host

Can you start a container from visual studio but somehow specify to run the container on a remote container host?
My specific scenario - I have an asp.net core app, I added docker support and want to debug using docker when I press F5, however, I would like to use a remote (other computer on the network) installation of the docker host.
This question may not even make any sense as I have probably misunderstood what I'm doing.

Getting an Unable to start debugging ... startup project could not be launched. Why?

I'm writing a new UWP app, using Azure DevOps with Git for source control. I'm doing development between my laptop and my desktop. I can debug the project fine on my laptop, but I cannot on my desktop. When I try I get this error message:
Unable to start debugging. The startup project could not be launched.
That's all it says. I started this project on my laptop, pushed it to Azure DevOps and have been developing on both the desktop and laptop. This is the first time I've tried debugging on both machines. Like I said, it worked fine on the laptop, but failed with the above error on the desktop. Don't understand what I've done wrong, but guess that I have. I'm using VS 2017, version 15.9.4
The application I'm working on is not a Core application. For that reason, I do not believe that this post elsewhere on Stack Overflow applies.

Deploying docker container to production server from Visual Studio 2017 RTM

I'm completely lost on this.
I have installed Docker on my Windows 10 machine. It is running. I shared out my C drive in Settings. I then created an ASP.NET Core 1.1 project with Docker support in Visual Studio 2017 RTM. Once the project was created, I hit F5 to run it. It built the container, deployed it to my local Docker installation, and launched my web browser. There is my web site running! Yay!
I'd now like to take that container, and deploy it to Docker running on a Linux machine, but there is no Publish option in Visual Studio for the docker-compose project. I can Publish the web project, but only to Azure or IIS.
I have looked all over for an answer to this, but all I can find is how to deploy locally, and I've already figured that out.
There is currently no publish option from within the tooling that will push an image to a registry, but you should be able to do this fairly easily. I would recommend to build the "release" configuration of the docker-compose project which should build an image locally. You can then use the docker command line to push that image to Docker Hub or Azure Container Registry, in which you can then pull it down to the Linux docker machine.
If your code is stored in a Git repo and it has a Dockerfile in the root, you can use Cycle to build the image on the server and deploy it there all in one easy to use interface.

Resources