DNN on Docker

An experience report with new technology

Agenda

  • Using Docker on Windows to run a DNN website within a container

    • Review current possibilities

    • Review current issues

  • Benefits of using containers

  • Current issues with Windows beta support for containers

     

Why Containers?

Consistent Environment

  • Fixes "Works on My Machine"
  • Development and production are the same
  • Required tools are in the container
  • Easy to install different versions

Ephemeral

  • Designed to be easy to destroy and re-create

Getting Started with Docker

Install Docker for Windows

https://www.docker.com/docker-windows

  • Requires Microsoft Windows 10 Professional or Enterprise 64-bit
  • Uses Hyper-V
  • Stable & Edge versions
  • Includes Docker and Docker Compose

Docker Command Line

docker version
docker image ls # or docker images
docker container ls # or docker ps

docker image pull microsoft/aspnet
docker container run --name=example1 -d microsoft/aspnet
docker container exec -it example1 powershell
docker container inspect example1
docker container stop example1
docker container rm example1

Docker Command Line

docker container run
    --name=example2
    -d
    -p 12345:80
    --mount type=bind,source="$PWD/images",target=C:\inetpub\wwwroot\images
    microsoft/aspnet

Docker Compose

version: '3.2'
services:
  web:
    image: microsoft/aspnet:4.7.1-windowsservercore-1709
    ports:
      - '22222:80'
    volumes:
      - type: bind
        source: ./images
        target: C:\inetpub\wwwroot\images
    restart: always

Docker Compose

version: '3.2'
services:
  web: …
  db:
    image: microsoft/mssql-server-windows-developer:2017-latest
    volumes:
      - "./db/:C:/temp/"
    expose:
      - '1433'
    environment:
      ACCEPT_EULA: 'Y'
      sa_password: 'DNN Summ!t'
      attach_dbs: '[{
        "dbName": "dnn",
        "dbFiles": [
          "C:\\temp\\dnn.mdf",
          "C:\\temp\\dnn_log.ldf"
        ]
      }]'

Dockerfile

FROM microsoft/aspnet:4.7.1-windowsservercore-1709

COPY wwwroot/ C:\\inetpub\\wwwroot

Docker Issues

Work in Progress

File Change Notification

Port Forwarding

Ephemeral

Made with Slides.com