$30 off During Our Annual Pro Sale. View Details »

Real-World Docker Images für .NET

Real-World Docker Images für .NET

Docker Images erlauben die standardisierte Verteilung und den homogenen Betrieb von Anwendungen, unabhängig der gewählten Technologie oder Programmiersprache. Jedoch gilt es einiges beim Erstellen von Docker Images zu beachten.

In diesem Webinar zeigt Cloud-Native-Enthusiast und Docker Captain Thorsten Hans, wie Docker Images für reale .NET-Projekte aussehen sollten, um unterschiedliche Aspekte wie effizientes Debugging und die Inner-Loop Performance zu adressieren. Darüber hinaus werden Sie lernen, wie Sie potenzielle Stolpersteine und Schwächen der “Standard”-.NET-Dockerfiles von Microsoft ausmerzen.

Thorsten Hans

October 20, 2022
Tweet

More Decks by Thorsten Hans

Other Decks in Technology

Transcript

  1. Real-world Docker images for .NET
    Thorsten Hans
    @ThorstenHans
    Cloud-Native Consultant

    View Slide

  2. Cloud-Native Consultant @ Thinktecture
    #Azure #Kubernetes
    #Cloud-Native #Docker
    Thorsten Hans
    [email protected]
    thinktecture.com
    thorsten-hans.com
    @ThorstenHans

    View Slide

  3. Why are you here?
    (What’s your experience with Docker)

    View Slide

  4. What we will cover today
    • Introduction
    • Production grade Docker images for .NET Apps
    • Remote debugging .NET Apps in Docker containers
    • Inner-Loop Performance for .NET Apps with Docker
    • Conclusion
    Talking Points

    View Slide

  5. Why are we talking about that
    • Different requirements must be addressed when building Docker images
    • Robust and secure for production usage
    • Troubleshooting and debugging should be easy
    • Fast feedback is required for inner-loop experience
    • Sometimes you may want to address all of those requirements using a single Dockerfile
    Introduction

    View Slide

  6. What we will cover today
    • Introduction
    • Production grade Docker images for .NET Apps
    • Remote debugging .NET Apps in Docker containers
    • Inner-Loop Performance for .NET Apps with Docker
    • Conclusion
    Talking Points
    P R

    View Slide

  7. - We’ll start from the default Dockerfile generated by VS Code
    - We’ll optimize overall image build-time by
    - Removing unnecessary stages
    - Streamline build and publish for .NET
    - Address common pitfalls for running real-world workloads in containers
    Production grade Docker images for .NET Apps

    View Slide

  8. Production grade Docker images for .NET Apps
    Demo

    View Slide

  9. What we will cover today
    • Introduction
    • Production grade Docker images for .NET Apps
    • Remote debugging .NET Apps in Docker containers
    • Inner-Loop Performance for .NET Apps with Docker
    • Conclusion
    Talking Points

    View Slide

  10. - VS Remote Debugger is not installed by default
    - Remote debugger could be
    - baked into the Docker Image
    - Installed on demand using docker exec (VSCode does that too, but it’s terrible slow)
    - Consider strict tagging policies when baking remote debugger into your images to
    differenciate between debug- and non-debug images
    Remote debugging .NET Apps in Docker containers

    View Slide

  11. Remote debugging .NET Apps in Docker containers
    Demo

    View Slide

  12. What we will cover today
    • Introduction
    • Production grade Docker images for .NET Apps
    • Remote debugging .NET Apps in Docker containers
    • Inner-Loop Performance for .NET Apps with Docker
    • Conclusion
    Talking Points
    E

    View Slide

  13. - As developers, we want fast feedback to improve our overall productivity
    - Hot-Reload is provided by dotnet watch
    - Rude edits will result in the app process being restarted
    - Set DOTNET_WATCH_RESTART_ON_RUDE_EDIT=true to force restart also when rude edits happen
    Inner-Loop Performance for .NET Apps with Docker

    View Slide

  14. Inner-Loop Performance for .NET Apps with Docker
    Demo

    View Slide

  15. What we will cover today
    • Introduction
    • Production grade Docker images for .NET Apps
    • Remote debugging .NET Apps in Docker containers
    • Inner-Loop Performance for .NET Apps with Docker
    • Conclusion
    Talking Points

    View Slide

  16. What we’ve covered
    • You’ve seen how to
    • optimize “OOB-Dockerfiles” for .NET Apps
    • add VS Remote Debugger to Docker images for .NET
    • optimze your inner-loop performance when building .NET Apps
    Conclusion

    View Slide

  17. What we’ve covered
    • Identify and address different requirements as early as possible
    • Optimize your Docker images to stay productive in the inner-loop
    • Lint your Docker images to meet containerization best practices (e.G. dockle)
    • Harden your Docker images and check for vulnerabilities (docker scan)
    Conclusion

    View Slide

  18. Q&A
    If you have further questions:
    shoot me a mail at
    [email protected] / [email protected]
    or tweet at
    @ThorstenHans

    View Slide