Run ASP.NET Core 3.1 Apps in Docker with HTTPS.

Поделиться
HTML-код
  • Опубликовано: 2 авг 2020
  • In this step by step tutorial I take you through how to package your ASP.NET Core app as a Docker Image and then run your image as a Docker container with HTTPS Enabled. This includes creating a dedicated self-signed development certificate, configuring user secrets and passing in the necessary environment variables to the container to enable HTTPS.
    We further configure this with Docker Compose for ease of use and reuse going forward.
    Level: Beginner / Intermediate
    📕 My Book: www.apress.com/gp/book/978148...
    😍 Patreon Site (Exclusive Member Benefits!): / binarythistle
    💻 Code on GitHub: github.com/binarythistle/S03E...
    🔗 Install Docker Desktop Via WSL: docs.docker.com/docker-for-wi...
    🔗 Docker Net Core Set Up: docs.docker.com/engine/exampl...
    🔗 HTTPS & Docker Microsoft Doc: github.com/dotnet/dotnet-dock...
    ⏲️-Time Codes-⏲️
    1:33 - Course Outline
    3:13 - Demo
    6:13 - Overview of Docker
    10:23 - Scaffold Up API
    18:40 - Build Docker Image
    24:48 - Run Our Inage (without HTTPS)
    27:39 - Some Container housekeeping
    31:32 - Generate Dev Certifcate for Container
    35:15 - Configuring User Secrets
    42:12 - Rebuild our image (with User Secrets)
    43:32 - Overview of Docker Run parameters
    48:26 - Run our Container with HTTPS (Docker CLI)
    49:40 - Migrate and Run in Docker Compose
    56:40 - Certificate file name case sensitivity
    58:20 - Final Thoughts
    58:52 - Patreon Supporter Credits

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

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

    This helped me immensely!! And was exactly the explanation I was looking for thanks. Will defiantly be watching more of your videos. Thanks

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

    Les I cant thank you enough for your tutorials. I always find solutions to my problems from your videos. Big Thanks

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

    Les, you are awesome!! I like all of your videos, you definitely deserve way more subs !

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

    Really appreciate the clarity and completeness of the content. 👍👍 Very practical and just what I needed!! Thanks

  • @mustafaazyoksul1372
    @mustafaazyoksul1372 2 года назад +2

    This is absolutely awesome. Helped me get out of a week long block in my project. Thank you so much.
    Video speed and amount of detail is spot on too.

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

    thanks for such a wonderful video. I left your microservice video to come here and learn a bit more about docker (I felt like I was lacking some well needed info). I'm going back to continue. thank you for been a good teacher

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

    Les , you are star mate !!
    Absolutely amazing tutorial.

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

    Amazing tutorial! Your content is simply superb. Keep up with the good work!

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

    Your video's are great: not too slow, not too fast. Sound and image quality is good. All necessary details are mentioned. Really useful information, that I can apply in my projects.

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

    the way you explain things is excellent! your video helped me a lot, thank you! Greetings from Argentina.

  • @lemurza5236
    @lemurza5236 3 года назад +10

    This is gold! I love the way you purposely show issues other will encounter rather than, and help them fundamentally understand what is going on, instead of just going through it the correct way first time around.

    • @binarythistle
      @binarythistle  3 года назад +7

      Thanks mate! Sometimes I think I over-explain, but I do like to point out areas where you could get tripped up, (because I do!). I actually think those areas are the parts where you learn the most anyway, so I'm glad you find the approach useful.
      Thanks for the feedback, really appreciate it!
      Les

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

    Yesterday I learned about the docker and today you bring this video :) thanks a lot Les 🎉🎉

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

    Thanks a lot for this video.You've excellently explained the https mechanism for asp.net core.

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

    Les Jackson's channel is probably the best Learning Platform!! Thank you for all the awesome work

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

      Wow! Thanks Abdul - that's really kind of you to say! Cheers Les

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

    Excellent lecture :) Congrats, Les!

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

    Thanks for a great video, very clear and selection of level of detail.

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

    thanks Jackson, This is an amazing sharing and super helpful for me and the details are very fantastic

  • @paisaconmaquina
    @paisaconmaquina 7 месяцев назад

    Awsome explanation, awsome detailed, awsome clarification, awsome to find you to explain this :D

  • @manman7985
    @manman7985 2 месяца назад

    Great job Les! Thanks a lot for the great tutorial. Would have been great if you could have also explained what changes when deploying release image in production, but even ASIS this is a tutorial of a great value. Thanks again!

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

    Wow, I am waiting for this type of lecture since long back. No time to do analysis and learn on my own. You became my God while in this Pandemic, not just because of this single video, but due to multiple Diamond like videos.

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

      Hi Ashok - thank you my friend for those lovely words - I really appreciate it! Glad you're enjoying the videos, take care, Les

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

    Thank you so much Les, much appreciated.
    I also noted that the docker file name must be "Dockerfile" otherwise the docker-compose file will complain and wont build the image.

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

    thanks bro for awesome explanation, very clear and easy to understand

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

    Many thanks, very useful and easy steps otherwise would be painful. All the best..

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

    Amazing in details dive inside docker..thank you so much

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

    Excellent tutorial! Particularly happy to see you do it through VS code and will try to replicate this on a Mac!

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

    Excellent tutorial, thanks a lot for clear instructions.

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

    your videos are a life saver! keep it up.

  • @knotprasertsimla3969
    @knotprasertsimla3969 День назад

    Wow!!!! Thank you. You are a good instructor❤❤❤😊

  • @WimOmbelets
    @WimOmbelets 8 месяцев назад

    I wish I would have found this video this morning because it would have saved me an entire day of swearing and reading a lot of things that might have worked in the past but don't anymore. Either way, thanks a lot!

  • @k12app_in
    @k12app_in 8 месяцев назад

    xcellent tutorial, thanks a lot for clear instructions.

  • @molitvenazajednicadvasrca8151
    @molitvenazajednicadvasrca8151 5 месяцев назад

    Thanks for making this video!

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

    Incredible guide! Thanks!

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

    Thanks. Fantastic job! Note: Amazon says you have 5 reviews on your book (average 4/5). But they only display the review by the guy who gave it a 2.

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

    Thank you very much, especially at the time of the video 15:17.

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

    Wow finally the wait is over :)

  • @feelsgoodman5339
    @feelsgoodman5339 4 месяца назад

    Thank you so much, this helped a ton!

  • @noahyannis2465
    @noahyannis2465 2 месяца назад +1

    Awesome tutorial, thanks a lot ! :)

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

    Thank you for the video sensei. Greating from Switzerland

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

      Hey Maxime! Nice to hear from you again! Hope you're safe and well in Switzerland!
      Locked down here in Melbourne, but we're all good!
      Stay safe,
      Les

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

      @@binarythistlenice to hear that your safe and well too, I hope everything is going to be ok in Melbourne.
      I m fine, Switzerland have ended the lock down we are doing fine here, I m still working from home and your videos are still very helpful :) thank you a lot.
      Stay safe

  • @MrCharlypesc
    @MrCharlypesc 2 года назад +1

    i Absolute love this.... you help me a lot...

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

    Fantastic content Les. You can hear the passion and commitment you have to the topic in all of your videos. Love listening, and working through them. I am a full stack consultant/developer but haven't really lived in the MS world at all. At 11:40 or so into the video you mention a command:
    code -r WeatherAPI
    which fails to work on my mac, after I had just installed the free version of vscode. Just a heads up that it might be something to mention to non-MS/vscode users out there.
    Thanks again for sharing you experience.

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

      I'm pretty late to the party, but to open a directory in code on Mac you can do code or if you're in the folder do code . to ref the current folder.

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

    I must echo the messages below, as always outstanding content and very helpful. GOD bless you my friend.

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

      Thanks mate, best wishes to you too from Melbourne!

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

    You are the best! Hey people He is the best i have ever met! Thank you :)

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

    Than you so much an excellent, well explained tutorial 😊

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

    Just sharing what I learnt yesterday. You can simply scaffold Dockerfile from Command Palette by pressing Ctrl + Shift + P and look for "Add Dockerfile" (after Docker extension installed). This will prompt and auto-generate Dockerfile into your project

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

    Thanks Jackson for your effort. You are the spider man of the dotnet.

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

    Thanks man, this really helped me

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

    Thank you for the great content I learn a alot from your videos you are great

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

    Thanks for that - you helped me a lot.

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

    Thank you Les!

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

    The best Channel, thanks

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

    Best video for this content I found on YT, I hope there is next video how we can hope this docker image on Kubernetes with HTTPS enabled, I tried to search it but not found it.
    @binarythistle please do create content video for this.

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

    thanks you for helping us.

  • @CarlosAndres-lv1zq
    @CarlosAndres-lv1zq 3 года назад

    Thank you so much, very helpful.

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

    Superb content !

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

    This helped a lot.

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

    Thank you very much for this video, well explained and you helped me fix my issue .
    Which was the case sensitivity of the certificate and also that it needs to have the same name as the entrypoint dll name.

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

    Great job 🙂

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

    This is a great video!

  •  3 года назад

    Great video!

  • @petemartinez3017
    @petemartinez3017 3 года назад +33

    Do you have a Production Environment Version of this tutorial? Still really good work on explaining how this works!

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

      Did you ever find anything covering this? I need it desperately, my searches aren't turning up with much.

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

    you are genius.. saved my day!!.. :)

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

    Dear sir, great content.

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

      It would be much appreciated if you could create a playlist with best practices and maybe some libraries you often use in daily work. (Mid-senior level would be best appreciated)

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

    This is an excellent, well explained tutorial. One thing that I'm wondering though- what are the steps to HTTPS secure such containers in production? And also- how to do it when having 2 ASP Core APIs, each in its own container, and you want them to talk to each other over HTTPS?

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

    Thank you!

  • @whatizzydoin
    @whatizzydoin 3 года назад +5

    Darn, just watched this after spending the day getting this implemented at work. Nice one. P.S. there is another environment variable for kestrel that allows you to specify the certificate name so that it doesn’t have to be named the same as the dll. Useful if you have multiple services using the same certificate (e.g. a wildcard one from a trusted CA).

    • @buka.a
      @buka.a 3 года назад

      Link to resource please

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

      Not sure if there are any specific resources that cover this. But if you check out docs.microsoft.com/en-us/dotnet/core/additional-tools/self-signed-certificates-guide you will see that a path is specified for the certificate in the docker commands. Based on that you can define either an environment variable or specify the location in your app settings or secrets files.

    • @buka.a
      @buka.a 3 года назад +1

      @@whatizzydoin Thank you

  • @cyrilw1
    @cyrilw1 3 года назад +5

    Great work Les. Would be great to see how you would be able to use different sql connection strings in different environments. If you know where I could find this info that would also be great, thanks.

    • @Nazaro4ka
      @Nazaro4ka 8 месяцев назад

      You can google it

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

    This is really awesome thanks for this video, can you please make a video on handling the concurrency issues in web api core.

  • @80amnesia
    @80amnesia 3 года назад

    great stuff thanks

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

    Perfect!!

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

    Thanks Jackson, it's very useful for me. How to use SSL certificate docker container in AWS EC2

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

    Thank you for this wonderful post. we would also like to see how this would work when we host it from linux container or linux machine. Love to know what are all the stuffs needs to be done in addition for Linux specially for making it a HTTPS.

  • @ShyamPatel-id9cw
    @ShyamPatel-id9cw 2 месяца назад

    Thank you

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

    That is cool, thank you very much! Do you want to make a video about Redis or Memcached with .NET ?

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

    Perfect!

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

    Thanks for sharing. One more thing I want to add like can we have one demo for api gateway and multiple microservices with docker compose and how we can deployed in azure... if possible can you create video for that...

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

    love it

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

    Good base explanation and POC, but some areas that could use more info on:
    * connecting to a db while using https (assuming secrets from azure or aws would be easiest for prod quality connection credentials)
    * setting it up with nginx and certbot/lets encrypt
    * doing this all at production quality. pet peeve of tutorials is *it's fine here, but don't do it in prod* that's not very useful for me 🤷🏼‍♂️

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

    No dislakes. This is the most powerfull measure.

  • @Benjamin-uz2kx
    @Benjamin-uz2kx 10 месяцев назад

    This was really fucking great. masterclass

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

    You have done a great job here. May I know will you be making the the same thing using .net 5?

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

    Nice bgm nice course

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

    Hi Les, Thanks for nice video.. Do you have any suggstion to deploy docker image to azure ?

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

    Wouldn't mind a video explaining how to set up Docker in WSL. I have tried and definitely run into issues.

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

    Please create a video on microservice using gRpc and .net core + docker

  • @bartlomiejuminski
    @bartlomiejuminski 2 месяца назад +1

    I love You

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

    Hi Les, Thanks for sharing such a wonderful video. could you please suggest some approach to run scheduled python script on azure which is making some calculation and storing result as CSV in Azure Blobs

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

    Thanks for the video!
    Can someone help me out applying this to a microservice architecture? Each service is happy to run in HTTPS, but breaks when it comes to communicating with each other. I think there is also an issue with docker-compose and how the DNS uses the image name as apposed to localhost.

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

    Hi, Les! Thank you for this amazing video, surely helped me a lot. However, I have some questions about it. Is it possible to commit the certificate on Github so anyone who forks the project doesn't have to configure the certificate themselves? Is it possible to make this out of the box with docker? Cheers!

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

    Hi Les, First, you are doing a great job on your videos, thanks for sharing. I have a question about running docker. I am using Visual Studio and added support for docker. When I run F5, it builds and loads the image in Docker Desktop. I am then able to navigate to the swagger document without an issue, but when I stop the debugger, I can no longer navigate to the swagger document even though the Docker Desktop shows the image is still running. Any Ideas? The second part is if I switch over to VS Code and go to the solution folder and try to manually build the image (I include -f [folder]\Dockerfile, the build process errors out with failed to compute cache key: I did change the . to the project folder

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

    King

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

    Hi, why you don't use more lightweight Alpine-based images? Thanks

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

    @Les Jackson
    #Les Jackson
    Hi, I was wondering if there is a way to utilize Typescript with dotnet core 3.1 and web api? I would really love to see the use of Typescript in the backend on dotnet core.

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

    For production, it is necessary to have the user secrets ?, or it would be enough to just specify the certificate path and password ?. I'm not sure how to do it.

  • @buka.a
    @buka.a 3 года назад

    You should do one with MSSQL database

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

    Hi, Good video. i'm doing a image .net Core 3.1 for Debian 9 stretch. But I have error to image sdk version and image runtime version they aren't compatible. Only can I use .Net Core 2.1 for Debian 9 -stretch ?.

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

    Hi. Can you teach us how we can deploy https in production? Thank you

  • @duanernivlys
    @duanernivlys 3 года назад +5

    Hi, I'm following this tutorial but whatever I do I still have this error, "System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer
    certificate could not be found or is out of date." any solution?

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

      Maybe because the password set for the certificate does not match your password in the secrets

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

    normally I don't commented on any of this, but this video was very helpful, do you have any advice on put this into production or its the same configuration?

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

    Hello, I'm new in docker world and I found this tutorial that help me to understand how to use https on the docker, but I have a question regarding the certificate, can I use one certificate for multiple API application? or we should generate one by one for every single API? thanks before

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

    If youre getting this error;
    Specify which project or solution file to use because this folder contains more than one project or solution file.
    Add .csproj
    RUN dotnet publish .csproj -c Release -o out
    Instead of
    RUN dotnet publish -c Release -o out