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!
  • НаукаНаука

Комментарии • 192

  • @mathiashove02
    @mathiashove02 4 года назад +4

    This is good stuff Les! Thank you, and greetings from Scandinavia.

  • @yasinbabaoglu3839
    @yasinbabaoglu3839 3 года назад +1

    again,So exciting and clear session. congrats again :) Thanks for the course Les. take care mate

  • @rasalshukla4046
    @rasalshukla4046 3 года назад

    Les , A big Thankyou to you . You made my day . You cover a lot of difficult things in a small time . Great Teacher

  • @quangduy924
    @quangduy924 2 года назад

    Respect. I appreciate what you doing for community. Thanks Les, that's awesome

  • @Filipibc1
    @Filipibc1 3 года назад

    This is the best class/tutorial on youtube about Docker Compose.

  • @erialmelo
    @erialmelo 4 года назад

    This is the best video, i have ever seen about docker. Good job.

  • @jaxparrow1794
    @jaxparrow1794 4 года назад +19

    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!

    • @binarythistle
      @binarythistle  4 года назад +5

      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

  • @nickeax
    @nickeax 3 года назад

    Thank you very much. Like all your videos, this is what most developers are looking for.

  • @kevinmaguire1845
    @kevinmaguire1845 4 года назад +1

    Watched 2 videos after finding your tutorials - Awesome - Great step by step walkthrough !! Looking forward to watching more,

  • @bijitpal8322
    @bijitpal8322 4 года назад +6

    Just what I needed!! Thanks for the amazing video.

  • @melody4mind
    @melody4mind Год назад +1

    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!

  • @user-gm8pd4do3i
    @user-gm8pd4do3i 3 года назад

    I love your explanatory teaching technique so much

  • @ntson1710
    @ntson1710 4 года назад +1

    Brilliant. A huge thank you from Canada, Les! Cheers mate

    • @binarythistle
      @binarythistle  4 года назад

      Hi Thai, my pleasure, hope you're safe and well my friend! Take care, Les

  • @ghatak71
    @ghatak71 4 года назад

    Awesome information shared! Much appreciated Les! Not much of this information were available when I started in 2017. This is exactly what I needed.

    • @binarythistle
      @binarythistle  4 года назад

      Hi Anirban! Cool I'm glad it helped you out - stay safe! Les

  • @beckhamsh3ban
    @beckhamsh3ban 3 года назад

    Your tutorials Are Very very very satisfying, nice, and elegant, thanks

  • @RobertCoulston_au
    @RobertCoulston_au 3 года назад

    Great starter for connecting API to SQL using containers... well done

  • @a-s733
    @a-s733 3 года назад

    Very clear example. Thank you. It helped me a lot. Thanks again.

  • @wicusbotha
    @wicusbotha 4 года назад +2

    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.

    • @binarythistle
      @binarythistle  4 года назад +2

      Nice one Wicus! I love to hear that! Cheers, Les

    • @ganirban82
      @ganirban82 3 года назад

      @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,

  • @damilola_adegunwa
    @damilola_adegunwa 2 года назад

    Thanks for being my best .net core teacher.

  • @pravink3585
    @pravink3585 4 года назад

    Thank you very much sir for such great video. You made it very simple to learn Docker things. Thank you again!!!

  • @fpsantos8222
    @fpsantos8222 4 года назад

    OMG Thank you! You just won a new student sub from Brazil!

  • @alexwang1701
    @alexwang1701 4 года назад

    Great tutorial. Thanks Les!

  • @GreenDimka1
    @GreenDimka1 3 года назад

    When I see Les mistyping I feel comfortable because it is not only me who has this "keyboard dyslexia".
    The video is great!

  • @vkg.codefactory
    @vkg.codefactory 3 года назад

    Awesome video, excellent presentation, thank you for this !!!

  • @raghavbuz
    @raghavbuz 4 года назад +3

    Thank you for sharing this...looking forward for more videos.

  • @shahid13384
    @shahid13384 3 года назад

    Step by step indeed. Thank you.

  • @goosebottleYT
    @goosebottleYT 3 года назад

    Thank you for this video! it was clear and understandable

  • @parsalotfy
    @parsalotfy 3 года назад

    I love your tutorials

  • @kmart2k1
    @kmart2k1 4 года назад

    Nice job. Learned a lot.

  • @TyMac711
    @TyMac711 2 года назад

    A great walk through!

  • @SLHooLigON
    @SLHooLigON 10 месяцев назад

    Thank you for the video. Awesome content

  • @haysuse9810
    @haysuse9810 4 года назад +1

    Extremely great and easy to understand tutorial

    • @binarythistle
      @binarythistle  4 года назад +1

      Thanks for the feedback Hay, that's what I'm aiming for so great to hear. Cheers, Les

  • @kothasuryakala3827
    @kothasuryakala3827 2 года назад

    Thanks alot for the detailed explanation, it really helped to resolve my issue.

  • @NitinGarg
    @NitinGarg 3 года назад +9

    @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.

  • @ianvink
    @ianvink 4 года назад

    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.

  • @Sekaranss
    @Sekaranss 4 года назад

    Extremely Great and easy to understand...thanks..

  • @rmohanrao
    @rmohanrao 4 года назад

    Great tutorial, thank you.

  • @MrMymusicmyguitar
    @MrMymusicmyguitar 3 года назад

    Excellent explanation. Thank you

  • @shakhil100
    @shakhil100 2 года назад

    Amazing explanation

  • @clerus2
    @clerus2 3 года назад

    Thanks for your great content as always. Fantastic!

  • @genius6240
    @genius6240 4 года назад +1

    Extremely amazing one!

  • @juzerhakimji9720
    @juzerhakimji9720 3 года назад

    Really useful video ! Thanks :)

  • @paolosartiano1454
    @paolosartiano1454 Год назад

    thank you very much!! great videos

  • @kvskrishnan
    @kvskrishnan 4 года назад

    pretty clear and well understandable steps. Thanks a lot bro :)

    • @binarythistle
      @binarythistle  4 года назад

      Cool! Thanks for the feedback, I'm glad you found it useful. Les

  • @kia3d
    @kia3d 4 года назад

    Great job mate

  • @ranjanv7103
    @ranjanv7103 3 года назад

    Thank you very much , great video.

  • @juhairahamed5342
    @juhairahamed5342 10 месяцев назад

    🎉good explanation

  • @MarkoMijuskovic
    @MarkoMijuskovic 3 года назад +18

    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.

  • @parsalotfy
    @parsalotfy 3 года назад

    Great videos

  • @vijaymoorthy8841
    @vijaymoorthy8841 4 года назад

    Great Stuff.Thanks

  • @amanjain9271
    @amanjain9271 3 года назад

    Thank you so much , Thanks a lot :)

  • @SoundIKS
    @SoundIKS 3 года назад

    Awesome and amazing.

  • @gopikrishnag41
    @gopikrishnag41 3 года назад

    Really very useful :)

  • @rdrgox
    @rdrgox 3 года назад

    thank you,
    worked perfect on Ubuntu Server 20.04

  • @nestormatias217
    @nestormatias217 3 года назад

    thanks really usefull this channel for Net developers i apprecieted that Les you're brillant

  • @Xkce16
    @Xkce16 3 года назад

    thank you les !

  • @antosha2224
    @antosha2224 3 года назад

    omg thank you very much

  • @somesbhowmick2082
    @somesbhowmick2082 Год назад

    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.

  • @akbare-z815
    @akbare-z815 4 года назад

    thanks for sharing

  • @ucretsiztakipci6612
    @ucretsiztakipci6612 4 года назад

    Great video, thanks for sharing it! I wonder what we can do for the existing database. We can not reset the database.

  • @erwinbernales136
    @erwinbernales136 4 года назад

    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.

  • @OnTheSpurOfTheMoment
    @OnTheSpurOfTheMoment 4 года назад

    Great job Les. Just wondering if 'depends_on' is advisable to be used when defining the API compose part?

  • @santhosh26d
    @santhosh26d 4 года назад

    Great videos!!!.pls do videos for microservices

  • @christostzaferis1362
    @christostzaferis1362 4 года назад +1

    thnx for the video

  • @programmershubea5768
    @programmershubea5768 4 года назад

    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?

  • @ahmadyamout6867
    @ahmadyamout6867 2 года назад

    Thank you dear for you videos. But dear how to deploy it to devops ci cd and the sql can do the update database

  • @ralphmaasgmailcom
    @ralphmaasgmailcom 4 года назад

    Hi Les great video. I have question,
    it is possible to run such a docker-compose on a rapsberry pi 4

  • @juliovillegas5899
    @juliovillegas5899 2 года назад

    TYVM

  • @samarthrout
    @samarthrout 3 года назад

    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.

  • @ashishagrawal2434
    @ashishagrawal2434 3 года назад

    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.

  • @shishirroy1516
    @shishirroy1516 4 года назад

    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?

  • @tushar1439
    @tushar1439 4 года назад

    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.

  • @lunaticore1992
    @lunaticore1992 10 месяцев назад

    nice video, dou you have any video doing the same but using .Net 6 ?

  • @whattowatchrightnow
    @whattowatchrightnow 4 года назад

    good stuff. but what if I wanted to use a certificate to connect from the docker container to MSSQL? Can you show us?

  • @speakerbugsounds9871
    @speakerbugsounds9871 4 года назад

    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

    • @speakerbugsounds9871
      @speakerbugsounds9871 4 года назад

      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!

    • @TheUnstoppableevil
      @TheUnstoppableevil 4 года назад

      Hey bro can u tell me how u connect them i am still having troubles..

  • @ItsDevOps
    @ItsDevOps 11 месяцев назад

    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

  • @RobertCoulston_au
    @RobertCoulston_au 3 года назад

    Hey Les, I had to use 127.0.0.1 instead of localhost to get the connection to SQL server to work

  • @monojoybhattacharjee8283
    @monojoybhattacharjee8283 3 года назад +1

    ​ @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

  • @rvrunkillyow716
    @rvrunkillyow716 9 месяцев назад

    sir, how about in microservices, do i need to create individual image for each service that i am going to create? thanks.

  • @TihomirKit
    @TihomirKit 3 года назад +2

    Hi, what's the music you used in your video (if it's some band / artist)? Thanks! :D

  • @santhosh26d
    @santhosh26d 4 года назад

    Hi les, great videos ..pls do videos for microservices

  • @talgatsabyrov9957
    @talgatsabyrov9957 4 года назад +2

    Perfect! You answered to all my questions. Like and Subscription

  • @mzuhry4263
    @mzuhry4263 3 года назад

    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?

  • @carlamckenzie2669
    @carlamckenzie2669 3 года назад

    What do we change to run a .Net Framework Application?

  • @khoufiwissem1086
    @khoufiwissem1086 3 года назад

    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

  • @usmantahir3452
    @usmantahir3452 2 года назад

    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

  • @nestormatias217
    @nestormatias217 3 года назад

    whic is the best practice to set up migrations if we are working with docker and microservices on production???

  • @yashtalaiche2806
    @yashtalaiche2806 2 года назад

    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

  • @akbare-z815
    @akbare-z815 4 года назад

    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?

  • @Irshu
    @Irshu 4 года назад

    59:48 can we can also specify as localhost, 1433 ?

  • @RaWMajkeL
    @RaWMajkeL 3 года назад

    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

  • @amitkumdixit
    @amitkumdixit 4 года назад

    How will take this approach to production. Since my database will have existing data. How is docker compose helpful in production.

  • @danieljunior6282
    @danieljunior6282 4 года назад

    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

  • @vchirilov
    @vchirilov Год назад

    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?

  • @emmanuel8296
    @emmanuel8296 3 года назад

    Thanks Les, however i spelt my Colour as Color...please how do one push both the database image and app to docker hub

  • @pollathajeeva23
    @pollathajeeva23 Год назад

    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.

  • @mikekilikis4657
    @mikekilikis4657 2 года назад

    So if I do this, can my app run on a linux server just by type docker compose up?

  • @eliassal1
    @eliassal1 3 года назад +3

    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

    • @npctako
      @npctako 2 года назад

      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

  • @linoypappachan4272
    @linoypappachan4272 4 года назад

    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).

  • @AlexGhoro
    @AlexGhoro 4 года назад +1

    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?.

    • @jeremygraham7786
      @jeremygraham7786 4 года назад

      Hey Alex, did you find a method of doing this in production?

    • @AlexGhoro
      @AlexGhoro 4 года назад +2

      @@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.

    • @jeremygraham7786
      @jeremygraham7786 4 года назад +1

      @@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.