Deploying .net API via docker hub

Viewed 12

Apologies in advance, this is probably a bit of a silly question but I'm a noob to Docker. I'm trying to push a .NET api to Docker Hub, then pull it down to a local Docker Desktop (windows) install and then run it as a container. I'm just using the in-built Visual Studio Publish To Docker Container Registry functionality to push to my Docker Hub account.

There are no errors, I can successfully upload the API to my hub repository, and then pull it to Docker and launch it as a container, but I can't then connect to swagger using any of the URLs I expected (ie, http://localhost:[port]/swagger). If I push directly to Docker using Visual Studio it all works fine.

I did wonder if I needed to specify a port, as I noticed that in Docker the VS-pushed container has a port assigned, but I've tried to add one in in the settings when I run the container and it makes no difference.

What on earth am I getting wrong?? Any help would be greatly appreciated!

Thanks

1 Answers

Embarrassingly, I figured this out when I realised that a) the API was being deployed as Release, and b) Swagger was only being set up when the environment was set to Development.

I apologise whole-heartedly for wasting everyone's time.

Related