Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

- 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

Slide 8

Slide 8 text

Production grade Docker images for .NET Apps Demo

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

- 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

Slide 11

Slide 11 text

Remote debugging .NET Apps in Docker containers Demo

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

- 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

Slide 14

Slide 14 text

Inner-Loop Performance for .NET Apps with Docker Demo

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

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