Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
@svswaminathan
http://wannabeegeek.com
Shipping Manifest
The Big Picture for working with Containers
Container Vocabulary
Container Architecture
Micro Services and Containerization
.NET Core
Visual Studio
Visual Studio TeamServices
Azure Container Service
Vocabulary
Commands
Container Lingua Franca
Host OS - Hardware
Hyper Visor
Guest OS #2
Start on Earth – Docker Hello-World
• Docker Containers and VMs
Guest OS #1 (Virtual Machine)
Docker Daemon
Server
Host OS
Hypervisor
Server
Host OS
Docker Engine
Guest
OS
Guest
OS
Guest
OS
Bins/Libs Bins/Libs Bins/Libs
App A App A’ App B
Bins/Libs Bins/Libs
AppA
AppA’
AppB
AppB’
AppB
AppB’
AppB
AppB’
Containers are isolated,
but share OS and, where
appropriate,
bins/libraries
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
PS docker search microsoft
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
microsoft/dotnet Preview images for the .NET Core command l... 107 [OK]
microsoft/azure-cli Docker image for Microsoft Azure Command L... 52 [OK]
microsoft/iis Internet Information Services (IIS) instal... 11
microsoft/oms Monitor your containers using the Operatio... 3 [OK]
microsoft/applicationinsights Application Insights for Docker helps you ... 3 [OK]
microsoft/sample-dotnet .NET Core running in a Nano Server container 1
microsoft/dotnet35 1
PS docker pull microsoft/dotnet
Using default tag: latest
latest: Pulling from microsoft/aspnet
604d05dfd165: Extracting [====================================================> ] 34.78 MB/37.19 MB
a3ed95caeb02: Download complete
af271166b5e5: Download complete
ffff72610562: Pull complete
82633c2ea8fc: Pull complete
1ec63dc1715b: Downloading [=========================> ] 29.72 MB/64.67 MB
9be54d5ae146: Pull complete
c3abf6246d6a: Pull complete
Digest: sha256:cbbc0a7be0926d017ffd952799c4864c2c6cf812cbb70862bf2c8539401aa1e3
Status: Downloaded newer image for microsoft/dotnet:latest
DOCKER_HOST
Images CacheContainers
RegistryClient
Docker pull Docker daemon
Docker run
Docker API
Dot
Net
Dot
Net
Dot
Net
Dot
Net
Vocabulary
Commands
Understanding the Docker Architecture
Building Docker Images
PS dotnet new
PS Code .
# add a docker file
PS dotnet build –c release
PS dotnet publish –c release –o app
PS Docker build –t helloworld .
Sending build context to Docker daemon 667.6 kB
Step 1 : FROM microsoft/dotnet:1.0.0-rc2-core
---> c7a9cf9c81f5
Step 2 : WORKDIR /app
---> Using cache
---> eb9360aaf982
Step 3 : COPY /app /app
---> Using cache
---> 80e66eaa09e0
Step 4 : ENTRYPOINT dotnet DotNetHelloWorld.dll
---> Using cache
---> e559e0c38fbd
Successfully built e559e0c38fbd
PS docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
helloworld latest ae30949a3358 5 seconds ago 242.4 MB
PS docker run helloworld
Hello World!
Registry DOCKER_HOST
ImagesContainers
Docker build
0001Program.cs110
HelloWorld.dll
111010111011011010
Code/Binaries
Client
Docker build
Docker daemon
FROM microsoft/dotnet:latest
WORKDIR /app
COPY /app /app
ENTRYPOINT dotnet HelloWorld.dll
dockerfile
Private Registry
Docker run
Docker push
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
Vocabulary
Host A VM running the Docker Daemon to host a collection of Docker Containers
Image An ordered collection of filesystems* to be used when instancing a container
Container A runtime instance of an image
Registry A collection of docker images
Dockerfile Commands to build a Docker image
Tag A version identifier for an image, plus the registry name
docker tag [registrypath]/image:[version]
Commands
Docker search Searches the current registry
Docker pull Pulls a Docker Image to your Docker Host cache
Docker run The process of instancing an Image as a running container
Understanding the Docker Architecture
ImageLayers.io
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
PS docker run -it -v /c/Users/Swami:/wormhole busybox
/ # ls
bin dev etc home proc root sys tmp usr var wormhole
/ # cd wormhole
/wormhole # touch a.txt
/wormhole # touch b.txt
/wormhole # ls
a.txt b.txt
/wormhole # cat a.txt
Hello from the other side of the wormhole
/wormhole #
http://beta.docker.com
Vocabulary
Host A VM running the Docker Daemon to host a collection of Docker Containers
Image An ordered collection of filesystems* to be used when instancing a container
– * see layers, later on
Container A runtime instance of an image
Registry A collection of docker images
Dockerfile Commands to build a Docker image
Tag A version identifier for an image
Volume A means to provide persistent storage from an immutable container
Commands
Docker run The process of instancing an Image as a running container
Docker login Logs into the registry so you can push images
Docker build Creates an image, using a dockerfile as the definition
Docker tag Renames an image: [registryname]/[user]/[imagename]:[tag]
Docker push Pushes an image to a registry
Docker-compose Volumes
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
PS docker-machine ls
NAME ACTIVE DRIVER STATE URL DOCKER
default - virtualbox Running tcp://docker v1/10.1
dockerhost-linux - azure Running tcp://dockerhost-linux.cloudapp.net:2376 v1.10.2
PS docker-machine env dockerhost-linux
$Env:DOCKER_TLS_VERIFY = "1"
$Env:DOCKER_HOST = "tcp://dockerhost-linux.cloudapp.net:2376"
$Env:DOCKER_CERT_PATH = "C:UsersSteveLas.dockermachinemachinesdockerhost-linux"
$Env:DOCKER_MACHINE_NAME = "dockerhost-linux"
# Run this command to configure your shell:
# Docker-machine env dockerhost-linux | Invoke-Expression
PS docker-machine active
dockerhost-linux
PS docker-machine ip dockerhost-linux
dockerhost-linux.cloudapp.net
Note: Docker Machine not required when working with Docker for Windows
PS docker-machine create -d azure --azure-subscription-id "[your azure sub id]"
--azure-open-port 80 mydockerhost
Docker Docs - Docker-machine create -d azure...
Azure Docs - Docker-machine create -d azure ...
Commands
Docker Docs - Docker-machine create -d azure...
Azure Docs - Docker-machine create -d azure ...
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
Local Development
Environment
Integration
Registry
Production
Staging
Test
Client
Container Workflow
Docker-compose up
Docker buildWrite/Edit
Run
Debug
Docker push
Integration
Registry
Production
Staging
Test
Container Workflow
Write/Edit
Run
Debug
CD
Scheduling
Orchestration
Local Development
Environment
CI/Build
Environment
SCC
Environment
• ASP.NET
• In Container Development
• Edit & Refresh
• Breakpoint Debugging
Integration
Azure Hosted
Private Registry*
Production
Staging
Test
Visual Studio Code
Write/Edit
Run
Debug
Visual Studio Team Services
• Source Code Control
• Build
• Continuous Integration
• 3rd Party Integration:
VSTS Build Agents w/ Docker
• VM Scale Sets
• Azure Container Service
• Azure Hosted Docker Private Registry
Azure Container Service
Visual Studio
• Docker Language Services
• Docker Scaffolding w/yo docker
public registry
ASP.NET
Orchestration&Scheduling-Marathon/DockerSwarm
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
Dockerfile
Optimized release version. Validate locally, deployed to production
Dockerfile.debug
Local version, used for debugging
Docker-compose.yml
Deployed version, used to instance multiple containers
Docker-compose.yml.debug
Local version, used for debugging
DockerTask.ps1
PowerShell, to coordinate all the local operations. Similar to a makefile
Docker.targets & Docker.props
Used by Visual Studio to hook the F5 experience
Sets the docker host. Blank Machine for Docker for Windows*
launchSettings.json
Docker entry point added to enable running in a Docker Container.
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
http://aka.ms/DockerToolsForVSTS
Azure Container Service High AvailabilityHyper-Scale
Microservices
Container hosts
as cattle
Flexible
programming
models
Azure Private cloud Other clouds
Open Source
Orchestration
Host cluster
management
Open Source Container ManagementHigh Availability High Density
Placement
Constraints
Fast startup &
shutdown
Self-healing
•
•
•
•
•
Layer Supported Technologies
(2015)
Configuration as
Code
ARM, Dockerfile, Docker
Compose
Host cluster
management
VM Scale Sets
Container
orchestration
Docker Swarm, Chronos,
Marathon, Apache Mesos
Monitoring OMS, App Insights
aka.ms/DockerToolsForVS
aka.ms/DockerToolsForVSTS
aka.ms/DockerToolsForVSCode
aka.ms/yodocker
aka.ms/AzureContainerS
ervice
aka.ms/WindowsContain
ers
http://wannabeegeek.com

More Related Content

Deploying .net core apps to Docker - dotnetConf Local Bengaluru

  • 3. Shipping Manifest The Big Picture for working with Containers Container Vocabulary Container Architecture Micro Services and Containerization .NET Core Visual Studio Visual Studio TeamServices Azure Container Service
  • 5. Host OS - Hardware Hyper Visor Guest OS #2 Start on Earth – Docker Hello-World • Docker Containers and VMs Guest OS #1 (Virtual Machine) Docker Daemon
  • 6. Server Host OS Hypervisor Server Host OS Docker Engine Guest OS Guest OS Guest OS Bins/Libs Bins/Libs Bins/Libs App A App A’ App B Bins/Libs Bins/Libs AppA AppA’ AppB AppB’ AppB AppB’ AppB AppB’ Containers are isolated, but share OS and, where appropriate, bins/libraries
  • 10. PS docker search microsoft NAME DESCRIPTION STARS OFFICIAL AUTOMATED microsoft/dotnet Preview images for the .NET Core command l... 107 [OK] microsoft/azure-cli Docker image for Microsoft Azure Command L... 52 [OK] microsoft/iis Internet Information Services (IIS) instal... 11 microsoft/oms Monitor your containers using the Operatio... 3 [OK] microsoft/applicationinsights Application Insights for Docker helps you ... 3 [OK] microsoft/sample-dotnet .NET Core running in a Nano Server container 1 microsoft/dotnet35 1 PS docker pull microsoft/dotnet Using default tag: latest latest: Pulling from microsoft/aspnet 604d05dfd165: Extracting [====================================================> ] 34.78 MB/37.19 MB a3ed95caeb02: Download complete af271166b5e5: Download complete ffff72610562: Pull complete 82633c2ea8fc: Pull complete 1ec63dc1715b: Downloading [=========================> ] 29.72 MB/64.67 MB 9be54d5ae146: Pull complete c3abf6246d6a: Pull complete Digest: sha256:cbbc0a7be0926d017ffd952799c4864c2c6cf812cbb70862bf2c8539401aa1e3 Status: Downloaded newer image for microsoft/dotnet:latest
  • 11. DOCKER_HOST Images CacheContainers RegistryClient Docker pull Docker daemon Docker run Docker API Dot Net Dot Net Dot Net Dot Net
  • 14. PS dotnet new PS Code . # add a docker file PS dotnet build –c release PS dotnet publish –c release –o app PS Docker build –t helloworld . Sending build context to Docker daemon 667.6 kB Step 1 : FROM microsoft/dotnet:1.0.0-rc2-core ---> c7a9cf9c81f5 Step 2 : WORKDIR /app ---> Using cache ---> eb9360aaf982 Step 3 : COPY /app /app ---> Using cache ---> 80e66eaa09e0 Step 4 : ENTRYPOINT dotnet DotNetHelloWorld.dll ---> Using cache ---> e559e0c38fbd Successfully built e559e0c38fbd PS docker images REPOSITORY TAG IMAGE ID CREATED SIZE helloworld latest ae30949a3358 5 seconds ago 242.4 MB PS docker run helloworld Hello World!
  • 15. Registry DOCKER_HOST ImagesContainers Docker build 0001Program.cs110 HelloWorld.dll 111010111011011010 Code/Binaries Client Docker build Docker daemon FROM microsoft/dotnet:latest WORKDIR /app COPY /app /app ENTRYPOINT dotnet HelloWorld.dll dockerfile Private Registry Docker run Docker push
  • 17. Vocabulary Host A VM running the Docker Daemon to host a collection of Docker Containers Image An ordered collection of filesystems* to be used when instancing a container Container A runtime instance of an image Registry A collection of docker images Dockerfile Commands to build a Docker image Tag A version identifier for an image, plus the registry name docker tag [registrypath]/image:[version] Commands Docker search Searches the current registry Docker pull Pulls a Docker Image to your Docker Host cache Docker run The process of instancing an Image as a running container Understanding the Docker Architecture
  • 20. PS docker run -it -v /c/Users/Swami:/wormhole busybox / # ls bin dev etc home proc root sys tmp usr var wormhole / # cd wormhole /wormhole # touch a.txt /wormhole # touch b.txt /wormhole # ls a.txt b.txt /wormhole # cat a.txt Hello from the other side of the wormhole /wormhole #
  • 22. Vocabulary Host A VM running the Docker Daemon to host a collection of Docker Containers Image An ordered collection of filesystems* to be used when instancing a container – * see layers, later on Container A runtime instance of an image Registry A collection of docker images Dockerfile Commands to build a Docker image Tag A version identifier for an image Volume A means to provide persistent storage from an immutable container Commands Docker run The process of instancing an Image as a running container Docker login Logs into the registry so you can push images Docker build Creates an image, using a dockerfile as the definition Docker tag Renames an image: [registryname]/[user]/[imagename]:[tag] Docker push Pushes an image to a registry Docker-compose Volumes
  • 24. PS docker-machine ls NAME ACTIVE DRIVER STATE URL DOCKER default - virtualbox Running tcp://docker v1/10.1 dockerhost-linux - azure Running tcp://dockerhost-linux.cloudapp.net:2376 v1.10.2 PS docker-machine env dockerhost-linux $Env:DOCKER_TLS_VERIFY = "1" $Env:DOCKER_HOST = "tcp://dockerhost-linux.cloudapp.net:2376" $Env:DOCKER_CERT_PATH = "C:UsersSteveLas.dockermachinemachinesdockerhost-linux" $Env:DOCKER_MACHINE_NAME = "dockerhost-linux" # Run this command to configure your shell: # Docker-machine env dockerhost-linux | Invoke-Expression PS docker-machine active dockerhost-linux PS docker-machine ip dockerhost-linux dockerhost-linux.cloudapp.net Note: Docker Machine not required when working with Docker for Windows
  • 25. PS docker-machine create -d azure --azure-subscription-id "[your azure sub id]" --azure-open-port 80 mydockerhost Docker Docs - Docker-machine create -d azure... Azure Docs - Docker-machine create -d azure ...
  • 26. Commands Docker Docs - Docker-machine create -d azure... Azure Docs - Docker-machine create -d azure ...
  • 31. • ASP.NET • In Container Development • Edit & Refresh • Breakpoint Debugging Integration Azure Hosted Private Registry* Production Staging Test Visual Studio Code Write/Edit Run Debug Visual Studio Team Services • Source Code Control • Build • Continuous Integration • 3rd Party Integration: VSTS Build Agents w/ Docker • VM Scale Sets • Azure Container Service • Azure Hosted Docker Private Registry Azure Container Service Visual Studio • Docker Language Services • Docker Scaffolding w/yo docker public registry ASP.NET Orchestration&Scheduling-Marathon/DockerSwarm
  • 34. Dockerfile Optimized release version. Validate locally, deployed to production Dockerfile.debug Local version, used for debugging Docker-compose.yml Deployed version, used to instance multiple containers Docker-compose.yml.debug Local version, used for debugging DockerTask.ps1 PowerShell, to coordinate all the local operations. Similar to a makefile Docker.targets & Docker.props Used by Visual Studio to hook the F5 experience Sets the docker host. Blank Machine for Docker for Windows* launchSettings.json Docker entry point added to enable running in a Docker Container.
  • 37. Azure Container Service High AvailabilityHyper-Scale Microservices Container hosts as cattle Flexible programming models Azure Private cloud Other clouds Open Source Orchestration Host cluster management Open Source Container ManagementHigh Availability High Density Placement Constraints Fast startup & shutdown Self-healing
  • 38. • • • • • Layer Supported Technologies (2015) Configuration as Code ARM, Dockerfile, Docker Compose Host cluster management VM Scale Sets Container orchestration Docker Swarm, Chronos, Marathon, Apache Mesos Monitoring OMS, App Insights

Editor's Notes

  1. Azure Container Service focusses on the configuration and management of the hosting infrastructure. We also provide key open source orchestration technologies. ACS does not provide an application development model. This has some advantages (e.g. more flexibility in application architecture) but some disadvantages (e.g. stateful applications need to be designed to manage their own state)