Docker Compose with .NET Core & SQL Server (Step by Step)
HTML-код
- Опубликовано: 10 июл 2024
- In this step by step tutorial, we show you how to use Docker Compose to spin up a .NET Core API with a SQL Server backend, with each running in their own Docker Container.
- My Book: www.apress.com/gp/book/978148...
- Patreon Site (Exclusive Member Benefits!): / binarythistle
If you want to skip to the construction of the docker-compose.yml file jump to 56 minutes in! - Наука
This is good stuff Les! Thank you, and greetings from Scandinavia.
again,So exciting and clear session. congrats again :) Thanks for the course Les. take care mate
Les , A big Thankyou to you . You made my day . You cover a lot of difficult things in a small time . Great Teacher
Respect. I appreciate what you doing for community. Thanks Les, that's awesome
This is the best class/tutorial on youtube about Docker Compose.
This is the best video, i have ever seen about docker. Good job.
Sir, I cannot begin to thank you enough.
You've pretty much set me on my way not only in regards to docker but in many other things.
Once more, THANK YOUI!
Awesome Nikola! Docker has fast become my absolute favorite tool so I want EVERYONE to learn and use it! Thanks for your lovely words - to know that I've helped someone makes my day! Cheers, Les
Thank you very much. Like all your videos, this is what most developers are looking for.
Watched 2 videos after finding your tutorials - Awesome - Great step by step walkthrough !! Looking forward to watching more,
Cool thanks for the feedback Kevin
Just what I needed!! Thanks for the amazing video.
Awesome! Glad it helped
Fun fact (from someone in the US): We don't use the "u" in words like color because news papers used to charge by the letter to print. It got dropped and stuck that way. Awesome video!
I love your explanatory teaching technique so much
Brilliant. A huge thank you from Canada, Les! Cheers mate
Hi Thai, my pleasure, hope you're safe and well my friend! Take care, Les
Awesome information shared! Much appreciated Les! Not much of this information were available when I started in 2017. This is exactly what I needed.
Hi Anirban! Cool I'm glad it helped you out - stay safe! Les
Your tutorials Are Very very very satisfying, nice, and elegant, thanks
Great starter for connecting API to SQL using containers... well done
Very clear example. Thank you. It helped me a lot. Thanks again.
Thanks again, for such a great tutorial! One hour well spent I followed coding along and everything is working like a charm as in your video. Awesome.
Nice one Wicus! I love to hear that! Cheers, Les
@Wicus Botha
,
Can u pls try it now and check that can api container able to connect sql-db container for data pulling ?
I am using host(Dev environment) as win 10- Pro , Version 10.0.18362 -Build 18362(OS) and docker-desktop,version:2.3.0.4(46911)-Engine:19.03.12 .
Pls, Check below thread..
github.com/microsoft/mssql-docker/issues/441
Thanks,
Thanks for being my best .net core teacher.
Thank you very much sir for such great video. You made it very simple to learn Docker things. Thank you again!!!
OMG Thank you! You just won a new student sub from Brazil!
Awesome, thank you!
Great tutorial. Thanks Les!
When I see Les mistyping I feel comfortable because it is not only me who has this "keyboard dyslexia".
The video is great!
Awesome video, excellent presentation, thank you for this !!!
Thank you for sharing this...looking forward for more videos.
Thanks Raghav!
Step by step indeed. Thank you.
Thank you for this video! it was clear and understandable
I love your tutorials
Nice job. Learned a lot.
A great walk through!
Thank you for the video. Awesome content
Extremely great and easy to understand tutorial
Thanks for the feedback Hay, that's what I'm aiming for so great to hear. Cheers, Les
Thanks alot for the detailed explanation, it really helped to resolve my issue.
@Les: I am a .net developer I am really struggling to understand the concept of the docker and how does it is used in the real-world scenarios. Your videos really help me to understand the concept and as well as I can relate with a real-world scenario. Thank You Very Much for all the effort and time you put together to cover the content.
Thanks Les, that was excellent. Consider adding links to positions in the video in your description, that way we can skip if there are areas we already know.
Extremely Great and easy to understand...thanks..
Great tutorial, thank you.
Excellent explanation. Thank you
Amazing explanation
Thanks for your great content as always. Fantastic!
My pleasure - thanks Brian!
Extremely amazing one!
Cool!
Really useful video ! Thanks :)
thank you very much!! great videos
pretty clear and well understandable steps. Thanks a lot bro :)
Cool! Thanks for the feedback, I'm glad you found it useful. Les
Great job mate
Thank you very much , great video.
🎉good explanation
Hi Les, this is a great startup video and I was wondering is there any chance that you could make a more advanced version of it? The topics that I would like to know more about would be:
1. Setting up custom .env files with your docker-compose files.
2. Setting up volumes to persist various SQL Server container data.
3. Running SQL scripts against the containarized SQL Server instance, not via EF migration but via docker-compose command possibly?
4. Overwritting appsettings.json variables via environment variables in docker-compose.
Great videos
Great Stuff.Thanks
Thank you so much , Thanks a lot :)
Awesome and amazing.
Really very useful :)
thank you,
worked perfect on Ubuntu Server 20.04
thanks really usefull this channel for Net developers i apprecieted that Les you're brillant
thank you les !
omg thank you very much
Great video, so much noise in internet, but no one explain in a simple way. It is straight to the point and clean explanation, Thank you. it will be great if you can make a video related topic how DotnetCore unit test test project will communicate with SQL server, I think it will be very small chnage in docker file. right now I am trying to do this stuff.
thanks for sharing
Great video, thanks for sharing it! I wonder what we can do for the existing database. We can not reset the database.
Thank you for sharing this...I was wondering if I can use this same technique if my asp.net core app is in a Docker container, but the SQL server is out in a private network.
Great job Les. Just wondering if 'depends_on' is advisable to be used when defining the API compose part?
Great videos!!!.pls do videos for microservices
thnx for the video
No worries - thanks for watching!
Hi Les, thank you i was able to connect the application with the sql server, now i wanted to pull the image on linux for hosting should i still use the previous image before i used docker compose?
Thank you dear for you videos. But dear how to deploy it to devops ci cd and the sql can do the update database
Hi Les great video. I have question,
it is possible to run such a docker-compose on a rapsberry pi 4
TYVM
Awesome one , really helpful. only issue i faced, the api fails first time and on re-building it works. i tried to troubleshoot but couldn't get breakthrough.
Hey Les, First of all, thanks for such an awesome content. I am following your S3 tutorials and I tried to dockerize the Commander API and SQL Server by following this tutorial. I succeeded but after having spent almost a day in trying to figure out that docker-compose doesn't do the migration of your DB. In this video you did a hack for the migration. Could you please tell how would you do it in an enterprise level solution? I googled many articles but couldn't find anything. Thanks.
Excellent tutorial. One small Q - I am using Docker Toolkit. In this case, few things are not working as mentioned in this tutorial. Is it possible to include the Docker Toolkit use case for future Docker related tutorials?
Thanks Les ,it was really a nice informative video.I also have almost same requirement .But my sql server is running on remote VM.So what changes you are suggesting ? I am able to telnet sql server from inside the container but my api not connecting to database and give me NET_SSL_Error.Please help.
nice video, dou you have any video doing the same but using .Net 6 ?
good stuff. but what if I wanted to use a certificate to connect from the docker container to MSSQL? Can you show us?
Called it on 3.0!! Great Vid, Im having someproblems getting my net core app to connect with sql though. 10 hours in and still trying though haha
I sorted it all out! I forgot to delete the images inbetween one of my attempts to change settings and thought that I therefore hadn't set the ports correctly. But I had haha learned a lot. thanks again!
Hey bro can u tell me how u connect them i am still having troubles..
Hi les - it possible to have visio chart for development lifecycle on how to tag the docker images - also dockerfile to build for each environment
Hey Les, I had to use 127.0.0.1 instead of localhost to get the connection to SQL server to work
@Vlad Pavliuk what do you mean by that exactly . If i run docker compose then it runs the second time or else like @Amit Dixit told like I restart the API container again to make it work. If u resolved the issue can you please help
sir, how about in microservices, do i need to create individual image for each service that i am going to create? thanks.
Hi, what's the music you used in your video (if it's some band / artist)? Thanks! :D
Hi les, great videos ..pls do videos for microservices
Perfect! You answered to all my questions. Like and Subscription
Awesome!
awesome video, I have 1 question: when I restore my database to SQL server on docker and then delete the containers. what will happen to my database? is it gone too?
What do we change to run a .Net Framework Application?
good job , i have question about the sql database connexion , why do you not use connexion string in appsettings.json ? if i use my credentials of my data base in appsettings.json i will get problem ? , thanks in advance for your help
Hi Les Jackson, Thank you so much for a great video content. Can you please make a video of same concept, that how to deploy SQL and API in azure containers? It would be great
whic is the best practice to set up migrations if we are working with docker and microservices on production???
i am trying to insert into Database with this everything work fine docker + api but in database there is no changes reflected but insert and retrive option work fine
Hallo Sir, Im curious about how the docker serve the API at port 80 instead of 5000 like what in your launchSettings.json. Is the cointainer has its own setting inside?
59:48 can we can also specify as localhost, 1433 ?
I have a question - last video you have shown how to deploy it to ubuntu - how do I do it now with docker-compose? Thanks for any tips
How will take this approach to production. Since my database will have existing data. How is docker compose helpful in production.
Hi Les, thank you for sharing! But i have a problem: I do the same thing and follow all steps, my docker compose
is exact equals but my api not connect to the sql server noway, Can you help me?
I have another sql server installed in default port for this i chenged my port in the compose to 1401.
Please, help -me!
greetings from Brazil
Hi Les. Can you please look at this time 50:56? You map 8080:80, however within container web.api works on port 5000, thus you should have mapped 8080:5000, isn't it?
Thanks Les, however i spelt my Colour as Color...please how do one push both the database image and app to docker hub
Hi Les, I could like to add some test for the same API to run that in GitFlows but it fails and result in connection error. Please me in this.
So if I do this, can my app run on a linux server just by type docker compose up?
Great tutorial les as usual. However, in the last part, when you run "docker-compose...." the 2 services run very fast and we can see the api container can connect to the sql, however, in my case, the sql container takes time and the api container fails to connect and exit, I need to open another PS and run the api service in spite of the fact that I added depends_on: - "ms-sql-server" but still docker-compose does not respect this and starts 1st the api container, thanks for your help
If by anychance you read this i need help on this problem as well (sql wont connect) any idea to waht yo do ? I need to push the file to heroku for school project
Thank you so much, such great stuff... Could you please do a tutorial on how to deploy docker containers in production(on-premise server with no internet connectivity and Azure cloud).
Ambada kallaaa
26:39 Hi again Jack, what do you suggest to do this in a production environment? It's there a way to access the dotnet-ef cli from the container right? like if I need want to run the database update to create my database?.
Hey Alex, did you find a method of doing this in production?
@@jeremygraham7786 Hello! actually no, I'm doing it like him, running the dbContext.Database.Migrate(); on the Startup class, Idk is that's too bad to be honest, in theory your application should not be restarting every time in production, btw I'm using postgresql and when I run the docker compose up the first time the container with my app stops/crash because the db isn't created yet, so I need to connect to the postgres container instance (that runs ok) and create the database there manually using the psql cli, then stop everything and run it again, and the migrations run without problems.
@@AlexGhoro gotcha, thanks for the update mate.I am using SQL but docker compose seems to crash my api too unless I manually migrate as shown here. I'm running into problems with this method when writing unit tests though. Thanks for the info.