Using Docker to supercharge .NET development on Linux

Alistair Chapman

@agc93

Docker

+ .NET Core

+ Linux

= 🎉

🐋

🤖

🐧

 

AGENDA

  • Introduction
  • Building with Docker
  • Building for Docker
  • Being a magpie developer 101

Thanks @thepracticaldev!

Introduction

Alistair Chapman

 

agc93

 

agc93

A Note on Moving Targets

1.1

2.0 Preview

Docker

  • Process and environment isolation
  • Supported on Linux, Windows (mostly) and macOS (sort of)
  • Currently undergoing a minor identity crisis

.NET Core

  • The next generation of the .NET platform
  • Supported on Windows, macOS (mostly) and Linux (sort of)
  • Currently undergoing a minor identity crisis

.NET Core on Linux

The bare essentials

Adding Docker to the Mix

  • Use a Dockerfile to build an image
  • You can then run your image to run your app in a container
  • Your base image decides the environment
FROM microsoft/dotnet:1.1.2-sdk

COPY . /app

WORKDIR /app

RUN ["dotnet", "restore"]

RUN ["dotnet", "build"]

EXPOSE 5000/tcp

CMD ["dotnet", "run", "--server.urls", "http://*:5000"]

Adding Docker to the Mix

Dockerifying a basic .NET app

Building with Docker

Using Containers for .NET Builds and tests

Building With Docker

  • Docker containers provide:
    • Isolation
    • "Clean" environment
    • Deterministic builds
  • Containers won't provide:
    • "Real-world" usage
    • Security for untrusted code*
    •  Compatibility guarantees

Building FOR Docker

Doing What The Cool Kids Do

Building Cloud-Native Apps in Containers

Building FOR Docker

  • Requires a new approach to architecture
    • Loose coupling
    • Isolation and autonomy
    • Stateless
    • Discovery and composability
  • Best gains from apps designed as "cloud-native"
  • Extremely well-suited to microservices

Building FOR Docker

Building FOR Docker

Where to next?

  • Try it out for yourself
  • Check out Windows Containers
  • Develop further with schedulers
  • Host on your platform of choice

Alistair Chapman

@agc93

(essentially everywhere)

 

https://blog.agchapman.com/

https://github.com/agc93/