Dockerize .NET 6 in 10 Minutes

Ғылым және технология

In this video, we're going to Dockerize our .NET 6 Web API built with TDD. We'll see how to build a multi-stage Dockerfile step-by-step. By containerizing our web API, it'll be much more convenient to manage the deployment our application to a variety of environments on-prem and in the cloud. We'll also set up a health check endpoint!
• 🤝 Become a Patron of the Channel!
Patreon supporters get access to source code from all episodes!
/ productivedev
• 👋 Get in Touch!
► Facebook bit.ly/productive-dev-fb
​​► LinkedIn bit.ly/wesd-linkedin
​​► Twitter bit.ly/wesd-twitter
​​• 🧑🏽‍💻 Udemy Courses
► Udemy bit.ly/wesd-udemy
• 🕘 Timestamps
0:00 - Intro
1:23 - Recap of the API
3:07 - Creating a Dockerfile
7:01 - Building the Docker image
8:25 - Running a Docker Container
10:01 - Testing Locally in Browser
10:25 - Adding a Health Check
12:00 - Rebuilding
12:49 - Testing Health Check in Browser
• 📚 Topics Covered in This Video
► Docker
► DevOps
► Dockerfile
► Dockerizing .NET
► .NET Health Check
► Docker multi-stage build
► Docker tagging► .NET 6► Web API Development

Пікірлер: 74

  • @williscoolerthanu
    @williscoolerthanu Жыл бұрын

    It is understated how nice it is that you are brief and well spoken. This stuff always ends up being an hour long video for 10 minutes worth of info.

  • @rajeshkannan1391
    @rajeshkannan13912 жыл бұрын

    Great Work !!! This is the clean and clear video of containerizing an api I have ever seen. Thanks for the short and superb video.

  • @Gollumfili
    @Gollumfili9 ай бұрын

    Just found your channel and I wish I had found it sooner! How you only have 40k is beyond me, excellent content that I can't wait get stuck into

  • @Kricris
    @Kricris11 ай бұрын

    Thank you very much, i'm just days into docker and i'm very invested. Love to see people that take the effort to explain

  • @2005Azm
    @2005Azm2 жыл бұрын

    Thank you! and of course so glad to see you again!

  • @WesDoyle

    @WesDoyle

    2 жыл бұрын

    Thanks Azim!

  • @axelgrefslie1746
    @axelgrefslie17462 жыл бұрын

    Just stumbles upon your channel, and very impressed of the quality of the videos and your teaching skills! Keep up the good work!

  • @WesDoyle

    @WesDoyle

    2 жыл бұрын

    Thanks Axel!

  • @janivimal
    @janivimal2 жыл бұрын

    Great session, simple and easy to understand , Thank you !!

  • @atuldongare8554
    @atuldongare85542 жыл бұрын

    A really good explanation. Short and simple.

  • @ahmedelgendy5363
    @ahmedelgendy5363 Жыл бұрын

    excellent this is the simplest example i see , thank you

  • @anuragchauhan2696
    @anuragchauhan26967 ай бұрын

    Thank you Wes Doyle for your help..... I was facing an issue and after watching this video....and follow the steps you mentioned, it worked for me, seamlessly. Thanks once again

  • @jovemprogramador7478
    @jovemprogramador74785 ай бұрын

    Perfect video, explained in a simple way

  • @davidkierzkowski
    @davidkierzkowski2 жыл бұрын

    Good to see you back !

  • @WesDoyle

    @WesDoyle

    2 жыл бұрын

    Thanks for watching David! Glad to be back!

  • @fernandoalanfillmann8739
    @fernandoalanfillmann87398 ай бұрын

    Thank you soo much! Very well explained!

  • @eduardkoryagin4792
    @eduardkoryagin47922 жыл бұрын

    Thank a lot, you are the star!

  • @obadayahya6176
    @obadayahya61767 ай бұрын

    Keep Going , thanks for the simple explanation

  • @tubaraomartelo
    @tubaraomartelo Жыл бұрын

    Great Job! Contratulations!

  • @cristiancarrillo7629
    @cristiancarrillo7629 Жыл бұрын

    Great video, thank you!

  • @Damotew-qv8fw
    @Damotew-qv8fw8 ай бұрын

    Thanks ,well explained

  • @zetbit
    @zetbit2 жыл бұрын

    Thanks, great video!

  • @RomeuMello
    @RomeuMello Жыл бұрын

    Thank you Sir!

  • @lindermannla
    @lindermannla9 ай бұрын

    Excelent tutorial! Thnxz!

  • @blu3_enjoy
    @blu3_enjoy Жыл бұрын

    I love Docker.

  • @user-qk5sq1jc5r
    @user-qk5sq1jc5r9 ай бұрын

    Nice video, thank you

  • @pt_trainer9244
    @pt_trainer92442 ай бұрын

    Thanks, i struggled with those overriding of ENV variables and wondered why it kept using port 80

  • @michelchaghoury870
    @michelchaghoury8702 жыл бұрын

    very helpfull please keep going we need more and more of your content, especialy more technicaly and more in depth, thank you

  • @WesDoyle

    @WesDoyle

    2 жыл бұрын

    Thanks Michel!

  • @jacobphillips9235
    @jacobphillips9235 Жыл бұрын

    Thanks!

  • @jacobphillips9235
    @jacobphillips9235 Жыл бұрын

    Great walk through man! Do you mind telling me what JSON Formatter that is in your browser?

  • @UrielChannel
    @UrielChannel2 жыл бұрын

    Great video, thank you! I've a question regarding the dockerfile, will it work if we change it like that: instead of line 4 (copy . .) we'll write (copy pathToCsproj destPathToCsproj), then dotnet restore command, then copy . . and finally dotnet publish? the purpose of this change is to cached the process of restoring nuget packages. again, thank you

  • @alysonramos3424
    @alysonramos34242 жыл бұрын

    nice video

  • @kdietz65
    @kdietz652 жыл бұрын

    I followed your instructions and it worked. Thanks! However, I need to be able to ssh into the app service for various reasons. Following your instructions doesn't install the necessary dependencies so that ssh will work (using Kudos from the Azure Portal). It would be great to do a follow-on video that explains this.

  • @jlpcpr
    @jlpcpr8 ай бұрын

    Hi Wes, I have a question. This works perfectly for me with Docker Desktop if I use a Linux based ASP .NET image. However, when I try to create the image using one of the official (Microsoft) Windows based underlying OS, like nanoserver, it tells me that the Operating System is not compatible. Do you know of a way to build the image using one of those as base?

  • @MrTatPol
    @MrTatPol2 жыл бұрын

    gracias por el tip de correr docker con la variable ASPNETCORE_URLS configurada, no entendía porque siempre se iba a la puerta 80!. Muy agradecido

  • @WesDoyle

    @WesDoyle

    2 жыл бұрын

    ¡gracias por ver!

  • @o.talisca
    @o.talisca11 ай бұрын

    This might be a dummy question but for example when using Laravel if we use volumes, the container source code will always be updated so we don’t need to always be resetting the container. Can it be done with .Net too?

  • @Gmaaa
    @Gmaaa Жыл бұрын

    Every time I make a change do I have to compile and upload the project?

  • @jithin.johnson
    @jithin.johnson19 күн бұрын

    is it vsvim that you are using?

  • @santiagocortez7903
    @santiagocortez79032 жыл бұрын

    Great tutorial, Wes! Really helpful. Just one small question, could you please share the VS theme and font name that you are using? Thank you!

  • @WesDoyle

    @WesDoyle

    2 жыл бұрын

    Hi Santiago. I'm using a custom VS theme. I believe you can find a recent version on my GitHub in the dotfiles repo.

  • @sylendrababujr9449

    @sylendrababujr9449

    Жыл бұрын

    @@WesDoyle Do you have the same theme which you have used in this video ? I have verified your github, but it is not matching with the one and also it's been very old. It will be good if you share the theme in the video as it is very awesome

  • @snivesz32
    @snivesz327 ай бұрын

    Thanks that was nice. While watching I had a thought, and you don't cover why we would want a 2 stage build process, perhaps because it's obvious, but also perhaps it is worthy of mention. Why wouldn't we publish directly to a runtime container? Because it would have all the artifacts from your machine allowing it to be built. You could have certain drivers, or registered dlls or environment variables that aren't present in test, or prod. The very reason for containerizing (or a close second) is that by sanitizing the build environment it ensures all team members code that gets merged together still builds in a standalone vanilla environment. In a nutshell its good practice for exposing untracked dependencies. Cheers!

  • @maximilliantimofte4797
    @maximilliantimofte4797 Жыл бұрын

    when I try to dockerize I get an error from visual studio: project targets windows and I need it on a linux container

  • @minhajulhoque3625
    @minhajulhoque36252 жыл бұрын

    the image is applicable for .net 4.6.1?

  • @wadson_sm
    @wadson_sm Жыл бұрын

    what extension you're using on browser ?

  • @glebbsif
    @glebbsif2 жыл бұрын

    Thank you. I have a question for you. I have, for example, 10 projects on 10 specific different services in my solution. It turns out that I can't create a Dockerfile at the solution level and I have to add the Dockerfile to each project separately. Right? But there is a problem. There is one more project in the solution, the eleventh. This is a library of classes with certain models. When I try to build a container, I get the following error about skipping building a common project with classes because it's not defined in the context of Dockerfile. How can I get out of this situation? Thanks

  • @WesDoyle

    @WesDoyle

    2 жыл бұрын

    good question, can be tricky at first. you can get it to work, though. just need to be aware of your Dockerfile definitions and build command context. Will try to make a video

  • @injenius21

    @injenius21

    Жыл бұрын

    I have this exact scenario - did you ever figure out the best way to handle it?

  • @ashkanmoghadasi5700

    @ashkanmoghadasi5700

    9 ай бұрын

    "For each executable project, such as a WebAPI or Console Application, it is imperative to possess a Dockerfile. As for the remaining projects, such as Class Libraries, that are employed within these projects, they are automatically integrated into your container via the 'dotnet restore' command."

  • @dgroh
    @dgroh2 жыл бұрын

    Great tutorial. What about HTTPS? You configured it in your docker run command, but it's not workking even after exposing 5001. Do you know how to get around on this?

  • @marcyanus1430

    @marcyanus1430

    2 жыл бұрын

    expose multiple ports using EXPOSE 5000-5001

  • @tsanalista

    @tsanalista

    Жыл бұрын

    Vocẽ pode usar no Dockerfile esse comando: ENV ASPNETCORE_ENVIRONMENT=Development

  • @user-ow6gy6xj5v
    @user-ow6gy6xj5v2 жыл бұрын

    How to deploy Docker container to the remote (ubuntu virtual machine) docker host?

  • @marcyanus1430
    @marcyanus14302 жыл бұрын

    On a multi-core cpu it won't be necessary to use switch --disable-parallel

  • @TheOkayUek
    @TheOkayUek8 ай бұрын

    Which app is that terminal emulator ?

  • @darkogele
    @darkogele Жыл бұрын

    And how do i do all of this with out docker desktop please help me :)

  • @Nurtylek
    @Nurtylek2 жыл бұрын

    r u planning to make videos on NodeJs?)

  • @WesDoyle

    @WesDoyle

    2 жыл бұрын

    nice idea, what would you like to see?

  • @Nurtylek

    @Nurtylek

    2 жыл бұрын

    @@WesDoyle let’s say real BFF(backend for frontend )

  • @bobbob-gv1ev
    @bobbob-gv1ev27 күн бұрын

    Please share a github link or similar to the dockerfile

  • @stasasekulic6917
    @stasasekulic6917 Жыл бұрын

    4:08 you just paste link out of nowhere, where can it be found? Why are you not using dockerhub?

  • @lastidea4925
    @lastidea4925 Жыл бұрын

    Is console apps the same to Dockerize?

  • @WesDoyle

    @WesDoyle

    Жыл бұрын

    Generally, yes

  • @lastidea4925

    @lastidea4925

    Жыл бұрын

    @@WesDoyle Thanks for answering :)

  • @SoulSovereignty
    @SoulSovereignty10 ай бұрын

    Since the #1 DB-connectivity MS recommends is Entity Framework (EF), and since the #1 approach for "EF DB migration" is sqlcmd "script based"...then I would expect there is at least one example in the galaxy of a docker file that installs `sqlcmd`...so that the EF DB migration can be executed (preferably from a Web API "migrate" endpoint). However, no such example exists...and there is no ability with any "Azure App Service" compatible docker images to install `sqlcmd`. If you tackled that mess, you would be a God.

  • @emsicz
    @emsicz8 ай бұрын

    Video starts at 3:10

  • @justmati9458
    @justmati9458 Жыл бұрын

    2:13 I've scared....

  • @vraja6812
    @vraja68122 ай бұрын

    Not able to understand docker commands

  • @AveN7ers
    @AveN7ers Жыл бұрын

    Fuck Microshit. I've been struggling with all sorts of errors trying to make the port mapping work. The node, go, postgres images work as expected but this shit gotta be a struggle because of Microshit.

Келесі