Getting Started with Docker on Windows

WHAT IS A CONTAINER?

By scmGalaxy.com

About Me

DevOps@RajeshKumar.XYZ

Docker simplifies software

If you already know how to use software, then you already understand Docker

What are the biggest challenges you face using software?

computer

dockerrun does all of this!

docker run
  • Find
  • Download
  • Install
  • Run
computer1

Challenges with Software Discovery

  • Where?
    • App store
    • Package manager
    • Standalone website
  • Metadata & stats
  • Trust
    • http
    • Code itself
  • Download availability
  • Payment

Challenges with Software Installation

  • Snowflakes
  • Compatible? Cross-Platform?
    • OS, OS version/build, CPU arch
    • macOS Sierra 10.12 x64
    • Win10 Anniversary Edition x64
  • Format
    • Source
    • Standalone executable
    • Executable + bundled libraries
    • Executable + shared libraries / runtime
  • Installers, package
  • managers, manual…
    • What did it install?!
  • Updates (auto updaters) & uninstall
  • Configuration Management nightmare

Challenges with Running Software

  • Helpful documentation
  • Where is it? PATH?
  • Starting and stopping
  • Service
  • registration
  • Licenses
  • Installing and running dependencies
  • Security & sandboxing
  • Breaking changes
    • OS updates
    • Shared library updates

Installing Docker for Windows

Docker simplifies software

Traditional Software Docker Equivalent Docker Command
Find software DockerHub
Download software,i.e. a zip file or MSI Pullan image docker pull
Install software Create a container froman image docker create
Start software Run the container dockerstart
Stop software Stop the container dockerstop
Uninstall software Removethe container dockerrm
NotPossible Do all of this with one command! dockerrun

Inverted learning

Use software without knowing how to set it up.

When ready, everything is consistently documented for you to learn how to set it up (Dockerfile).Inverted learning

Installing Docker on Windows Server

easy

Docker is a front end for running containers.

(for now)

Software Layers

software layer
computer2

Layer Reuse

layer reuse

Containers are lightning fast compared to VMs

Windows Container Types

window container tool

Host or Container Host

The machine that you run containers upon.

Running Command Line Apps in Containers

key takaways

Run Software with a Consistent Command

Share Host Files with Container Processes

container

Building Images to Host Web Sites

Web Site Static Files

web site static file
container1

From Commands to Dockerfile

						
	dockerrun -d -p 8080:80 --name nginxnginx
	docker cp.\app\. nginx:/usr/share/nginx/html
	docker commit nginx solitaire:nginx
						
						

From Commands to Dockerfile

Dockerfile

						
	FROM nginx
	COPY app /usr/share/nginx/html
						
						

dockerbuild –t solitaire:nginx.

key takeaways

  • Containers come from Images and Images come from Containers!
  • Container Layer – read and write
  • Dockerfile - script to build an image

Running Databases in Containers

Docker Managed Data Volumes

docker manage value

key takeaways

  • Two Volume Types
    • From host file system (bind-mount)
    • Managed volume
  • Volumes
    • Bypass UnionFS
    • Independent lifespan
    • Not part of images!
  • Read heavy data in images
  • Write heavy data in volumes (DB)
    • Especially memory-mapped files

Composing Applications with docker-compose

From Commands to docker-compose.yml

						  
dockerrun --name db`
	-d `
	-p 3306:3306 `
	-e MYSQL_ROOT_PASSWORD=my-secret-pw `
	-v db:/var/lib/mysql`
         mysql
dockerinspect db# extract ipaddress
dockerrun --name web `
	-d `
	-p 8080:80 `
	-e MY_DB_PORT=3306 `
	-e MY_DB_HOST=? `
	-v /my/php/app:/usr/share/nginx/html `
	nginx						  
						  
						

From Commands to docker-compose.yml

						  
dockerrun --name db-d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=my-secret-pw -v db:/var/lib/mysqlmysql
dockerinspect db# extract ipaddress
dockerrun --name web -d -p 8080:80 -e MY_DB_PORT=3306 -e MY_DB_HOST=? -v /my/php/app:/usr/share/nginx/html
nginx						  
						 
						

From Commands to docker-compose.yml

						  
	version: ‘2’
	services:
	  db:
	  image: mysql
	  ports:
	   -3306:3306
	  environment:
	   -MYSQL_ROOT_PASSWORD=my-secret-pw
	  volumes:
	   -db:/var/lib/mysql
	   
	  web:
	  image: nginx
	  ports:
	   -8080:80
	  environment:
	   -MY_DB_PORT=3306
	   -MY_DB_HOST=db
	  volumes:
	   -/my/php/app:/usr/share/nginx/html
							  
						  
						

key takeaways

  • Dockerfile: images
  • docker-compose : containers (and more)
  • User defined networks

questions?

questions

THANKS!!!

www.scmgalaxy.com

www.scmgalaxy.com