Containers with Docker Introduction

June 29, 2019    Development Containers Docker Presentation

A Docker Introduction for an hour Lunch and Learn

We have a lot of lunch and learns at Omnitech . I enjoy these times where most of the developers can get together, share what we’re learning, and learn from others’ experiences and hard work. We have found the value of helping each other leap frog up the learning ladder.

I was able to go to NDC Minnesota 2019 . I had the privilege of attending Shahid Iqbahl ’s (from the U.K.) 2 day workshop on Docker and Kubernetes (k8s). You can read more about that experience on the Omnitech blog .

This is my outline and information for my presentation. It does not have all of what I’ll say and I probably won’t get through it all. Maybe it will be helpful to you as well.

Note: I’m using [*] to denote references.

What is it?

“Docker is an application platform. It lets you package your application with everything it needs, from the operating system upwards, into a single unit that you can share and run on any computer that has Docker. Docker runs your application in a lightweight, isolated component called a container” [0]

“fully self contained abstraction layer” [3] – see the video in the link

A Continuum

Overtime, the industry has mostly moved from Hardware to VMs. Are we now going to Containers then Serverless?

Hardware > VM > Containers > Serverless

Windows Requirements [3]

“Hyper-V isolation expands on the isolation provided by Windows Server containers by running each container in a highly optimized virtual machine.”

Windows 10 and Windows Server 2019 and Windows Nano Server

Working towards frictionless with Linux. Microsoft is working with Docker.


Docker first got this working in Linux with parts that already existed in Linux. [0] [4]

The Docker Landscape

  • Host
  • Engine
  • Image - the blueprint, immutable, avoid state when possible
  • Repository - a place to store images (on-premise, Docker Hub, Azure Container Registry, etc…)
  • Container - container is the running instance of image
  • Dockerfile - used to package your application

From [0] presentation PDF

Vms vs Containers

[0] and page 10 of the presentation PDF

“A container may be only tens of megabytes in size, whereas a virtual machine with its own entire operating system may be several gigabytes in size. Because of this, a single server can host far more containers than virtual machines.” [7]

Image Layers

Docker layers

The image is on this page

The image link

Each action in the DockerFile creates a new layer and increases the size of the image. Be aware of this to keep image sizes smaller. [1] Chapter 2.

CLI Demos - get a taste

Workshop exercises from NDC 2019 [0]. Docker Succinctly also had good examples [1]. You can try out Docker, without installing it at Kata Code .

See Docker commands Cmder aliases save you from typing docker over and over. Alias d=docker $*

d version

d image ls

d ps (what’s running)

d pull redis

d run --name myredis redis Ctrl+c break out, still running

d ps (what’s running) d stop myredis d ps

Run and remove immediately d run --rm redis

  • for experiments, so you don’t forget to remove it

Run in detach mode (run most things, just starts and returns the hash) d run -d redis

Remove image (short for d image rm redis) d rmi redis --force

You can tag d run shahiddev/k8s:1.0

Map port > localhost:8081 d run -d -p 8081:80 shahiddev/k8s:1.0

“RDP/SSH” d exec -it 96f bash

Developer Workflow


Microsoft DevOps workflow from PDF [14]

from PDF [14]

Small steps

  1. Dockerfile
  2. Docker-compose.yml
    1. Docker-compose up -d, but if the server goes down you lose everything
  3. Docker Swarm is the next easy step, but “dead-end”
    1. Just go to K8s
    2. You don’t need an orchestrator, but you’ll want it very quickly because of the benefits


Why would we use it?


reference, my handwritten notes from [0]

Can make onboarding much easier and faster. There are no environments to setup besides Hyper-V and Docker.

When would we use it?

  • Moving from Monolithic to smaller services (micro-services)
  • Running tests on a build server. You don’t need installed on the sdk build server (ex: new .Net Core version comes out)
  • Old applications that need to move
    • PHP => consistent settings
    • Old .Net framework that might not be installed on the server you want to move to
    • others?
  • To help Onboarding
  • Deployment consistency issues
  • more reasons?

When not to:


  • Client team isn’t technically ready
  • I asked the Dev team, they said don’t run databases in containers, use Azure SQL, something else for production
    • Local dev (it makes sense here), might be some things to look out for, map to local drive
    • MS Build SQL server on the edge announcement?
    • MongoDB can run in a container
    • has to be horizontally scalable
    • maybe this will be come more common going forward?
  • New problems created:

[0] notes


Following the quick-start from Microsoft [5].

Install Docker Desktop (download or use Chocolately choco install docker-desktop [6])

Windows 10 Professional or Enterprise with Anniversary Update (version 1607) or later. requirements .

Make sure Hyper-V is enabled in your Bios

Hyper-V setup in Dos

  1. Choose your base image (stick to the curated list, unless you have a really good reason)
  2. Create a Dockerfile to add your application needs See my dockerfile created with VS
  3. Publish it to a registry
  4. Pull and run the container (AKS, on premise, Azure App Service)
  5. Setup a DevOps Pipeline to create the image on check-in, publish it to the registry and publish it to the host
  6. Consider orchestration (K8s)

Treat containers and clusters as cattle, not pets [11].


State is not persisted in an image. Volumes can be mounted to persist and share data written to the disk. [8] “Keep your containers as stateless as possible”[0]


Docker Swarm (basically defunct, though Docker Inc is selling services to help you convert to K8s) with docker-compose K8s = Kubernetes (8 letters in between K and s) and A11s = Accessibility

Why do you need an orchestrator? See the list on Microsoft’s Docs .

I saw in a Docker Con 2019 top 10 takeaways article, “don’t run K8s on premise unless you have to and know what you’re doing” (something like that).


  • Be aware of what base image you’re pulling from Docker Registry [1]
  • Has isolation
  • Limit resources - it can take all of your CPU
  • Protect secrets (Azure KeyVault)
  • Isito (tool for K8s) can help with monitoring and SSL [10]
  • Since containers are lightweight and start quickly, you can replace them often and slow down hackers


  • Azure Container Registry (ACR)
  • Azure Container Instances (ACI)
  • Azure Kubernetes Service (AKS)
    • Azure Dev Spaces look really useful
  • Azure Service Fabric (prefer AKS over this)

choco install azure-cli

TDD your Dockerfiles

Ryan Hochsteler at NE Code 2019 introduced me to the idea of TDD-ing your Dockerfiles.

Since "config errors are costly", then we should have automated tests for our config files.


  1. Google Container Structure Tests
  2. DockerSpec has more features, but requires RubySpec

What’s Next For Me

Another L&L about K8s.

Read Docker Succinctly.

Practice and use containers.

Watch more videos.

Learn more about the Visual Studio and VS Code tools.

Learn from looking at and running the eShopOnContainers eBook and code. [13]

Learn and practice with Helm and Azure Dev Spaces.

There is a ton to learn and a need to gain experience.


I'm using [*] to denote references.

[0] NDC Shahid Iqbal’s workshop PDF of his workshop (you’ll have to contact him to ge that) My Notes: Docker and Kubernetes workshop Shahid’s talk on YouTube

[1] Docker Succinctly

[13] eBook and reference code from @ardalis and Microsoft

DotNetRocks filter by the Containers tag [10], [4]

MSDN magazine had a series. I even tore them out of my physical magazines.


[3] Microsoft Docs on Windows Containers



[7] - June 2017, a bit out dated


[9] - they run more than 2 billion containers a year with K8s!


[12] Visual Studio tools ,

Microsoft Build 2019 videos (search for containers)

Microsoft Learning Paths

[14] Docker Dev workflow See the PDF linked as well

Microsoft SQL on containers Webinar in May 2019

Shaid’s blog

Kata Code - practice and learn

K8s Videos

Kubernetes and containers are growing up fast, survey shows - June 22, 2019

Free Udemy course (as of July 17, 2019) Docker, From Zero To Hero: Become a DevOps Docker Master

Use Docker for SQL Integration Tests

Watch the Story for Good News
I gladly accept BTC Lightning Network tips at [email protected]

Please consider using Brave and adding me to your BAT payment ledger. Then you won't have to see ads! (when I get to $100 in Google Ads for a payout, I pledge to turn off ads)

Use Brave

Also check out my Resources Page for referrals that would help me.

Swan logo
Use Swan Bitcoin to onramp with low fees and automatic daily cost averaging and get $10 in BTC when you sign up.