Sign in
Log inSign up
Sam Walpole

52 likes

·

22.3K reads

19 comments

Rajeev Ranjan Roy
Rajeev Ranjan Roy
Oct 27, 2020

Hi Sam, Thanks for sharing such a nice article. I have followed your steps and getting one issue while testing it through swagger. I am getting a sqlexception "Notes object not found", tried to check by debugging code stating from Main. I can see the same error under dbcontext object. Hope you would understand the issue. if you can guide me to pass through this exception.

1
·
·2 replies
Rajeev Ranjan Roy
Rajeev Ranjan Roy
Oct 27, 2020

I am able to resolve this issue, forgot to add initial migrations.

1
·
Sam Walpole
Sam Walpole
Author
·Oct 27, 2020

Rajeev Ranjan Roy

Hi Rajeev, Thank you for the comments. I'm glad you managed to resolve your issue. It's my mistake that I forgot to write about adding the migration in this post. I will update it shortly.

Many thanks

1
·
Yash Tiwari
Yash Tiwari
Sep 16, 2021

Amazing article man! I have bookmarked this along with other resources of free Docker tutorials.

1
·
·1 reply
Sam Walpole
Sam Walpole
Author
·Sep 16, 2021

Thanks a lot for your kind comments :)

1
·
Bob
Bob
Dec 6, 2020

Great article! The only problem I faced is that each time I run the docker-compose project it results in a new SQL container being created and all my data is lost after each run! Do you have any solutions?

·
·1 reply
Sam Walpole
Sam Walpole
Author
·Dec 13, 2020

Hi Bob, Thanks for the comment. I can't say that I've experienced the same issue - my Docker containers retain data between runs, unless I explicitly delete them. This article might have some useful tips to help you with persisting your data - centinosystems.com/blog/sql/persisting-sql…

·
Antonio Matušan
Antonio Matušan
Dec 9, 2020

Hi Sam, thanks for the tutorial, it clarified a few things for me. I have followed the steps and everything was working with the docker, mssql server got up and my page was loading. After not doing anything on the project for 2 days, I came back and pressed "docker compose" in visual studio. I got an error (no matching manifest for linux/amd64 in the manifest list entries).

I was thinking of recreating the whole process but with the only exception of choosing Windows as an OS for Docker Compose.

Does this problem have anything to do with this? I am running Docker on Windows 10.

Thanks!

·
·1 reply
Sam Walpole
Sam Walpole
Author
·Dec 13, 2020

Hi Antonio, I'm sorry that you are getting those errors - it's not something that I have experienced myself. Perhaps this page might be useful to you? stackoverflow.com/questions/48066994/docke…

·
Antonio Nicasio
Antonio Nicasio
Jan 21, 2021

Quick question I'm no expert in C# and .Net Core Technologies, my question is this docker implementation can work with an N-tier project solution?

·
·2 replies
Sam Walpole
Sam Walpole
Author
·Jan 21, 2021

Hi Antonio, Thanks for the question. I presume that each of your tiers is just class libraries that are referenced by your application project? If so, yes it will work fine :)

·
Antonio Nicasio
Antonio Nicasio
Jan 21, 2021

yes, the other tiers are just layer classes for logic business, etc. Sam Walpole thank you for the quick response.

·
Alex Hay
Alex Hay
Jan 22, 2021

Hi Sam,

Thanks for the guides, they've been super helpful :)

Having an issue with this one though. When I run the solution from your GitHub through the Docker Compose project the page localhost:49167/weatherforecast then loads up with the message localhost refused to connect.

The NotesController page does the same thing and I can see breakpoints in the constructors aren't hit, although I have no issue stepping through the code in Program or Startup.

Looking at Docker Desktop and clicking open in browser from the DockerCompose container (created from the solution) and clicking Open in Browser takes me to localhost:1433 which gives the error localhost didn’t send any data.

If I look at the log for the SQL Server container I can see Logon Login failed for user 'sa'. Reason: Failed to open the explicitly specified database 'AppDbContext'. [CLIENT: 172.22.0.3] before it starts up the database.

I assume this is the issue - any idea how to resolve or debug this further?

I've tried adding my own secure password for the SQL instead of the one in your solution, several different ones with the same results.

·
·2 replies
Alex Hay
Alex Hay
Jan 22, 2021

Restarted my computer and now it works fine shrugs

·
Sam Walpole
Sam Walpole
Author
·Jan 23, 2021

Alex Hay Ah that's odd. At least it's working now! I've sometimes had issues where the .NET container gets created before the SQL container, which throws a similar error. Restarting the project usually fixes that.

·
vilem cech
vilem cech
Feb 14, 2021

Really good article. Helped me a lot. Only thing i had to change was omitting exposure of the ports in the dockerfile and app.UseHttpsRedirection(); in Startup. Tbh i dont know why it didnt work for me, probably my ports arent set up correctly. Other then that i have my app running on localhost now, so thanks a lot.

·
Tim
Tim
Oct 3, 2021

Hi Sam, Great article. I am new to Docker and so please forgive my ignorance ;). I am an experienced .net developer and to save time I have literally downloaded your code as it is as my goal is to learn how to deploy .net code with SQL server to Docker. I have followed your instructions and everything works from Visual Studio as expected, however as soon as I close Visual studio the containers in Docker are gone (although the images remain). My assumption is that the environments/containers are purely a development construct. So my question is once I have developed my application and it works as expected, how do I go about deploying it to a docker container as a finished product?

·
MahmoudAbojahel
MahmoudAbojahel
Dec 1, 2021

Thanks for sharing such a perfect article

·
John Pankowicz
John Pankowicz
Mar 1, 2022

Thanks for the great article.

After cloning your project, I thought I would also be able to build & run the containers with "docker-compose up". But I encountered many problems. (Unable to start Kestrel, db login failure, db seed failure). I would solve one problem and find another.

I finally realized that the containers can only be built successfully by running the docker-compose (.dcproj) project. When that runs, entirely different Dockerfiles and docker-compose.yml files are used, as can be seen in the "container tools" output window.

In other words, if I use Visual Studio to create docker containers, it appears that only developers who use VS will be able to work on the project. This would be a problem on an open source project, where developers are using many different tools. Is this a fair assessment?

·