Save and Run Container created from visual Studio Docker Support

718 Views Asked by At

We have been starting to convert our Microservices to containers and we have been successful with the help of visual studio 2017. The process as straight as it can be, using the dockerfile generated from the add docker support feature(I answer a question about this here ). Then we can obviously debug and run it from visual studio without any problems. If i stop and then start the same container again from Kitematic, it doesn't work.

We tried to extract the working container by using the following commands:

  1. docker save name:tag -o [path_to_file]\Image.tar

  2. docker load -i [path_to_file]\Image.tar

  3. docker run -t -d -p 8080:80 name:tag

when we run docker ps everything runs fine, the status is Up, with the defined ports, but is not responding to any HTTP requests.

What are we missing?

1

There are 1 best solutions below

0
Júlio Almeida On

In meantime i was able to solve the problem, but looks like a strange solution. If you end up having the container running just fine in Debug but not in release, i advice you to:

  1. Don't use .Net Standard projects with .net core dependencies (in our case we end up using a GlobalExceptionFilter in a .NET Standard project).

  2. To solve this problem you can make a nuget with this dependencies and then use it across projects. (the nuget in this case is here for exemplification: https://www.nuget.org/packages/Backend.BaseApi)

  3. If you are not successful, you can always change everything to .Net Core, or start a new application, run in release, and incrementally add code to troubleshoot the problem.

Good luck