KEMBAR78
Developer workflow with docker | PPTX
Developer Workflow using
Wyn Van Devanter
@wynv
wyn.vandevanter@excella.com
https://github.com/excellalabs/docker-workshop-1
Vic Kumar
vic.kumar@excella.com
Cloud Enabling Technologies
• Virtualization
• Private Platform-as-a-Service
• Cloud management software
• Automation software
• Containers
Cloud market: 23 billion in 2017, 39 billion by 2020
What is Docker?
• A VM gives you a OS in a window
• A container gives you a file system via background process(es)
VMs vs Containers
• VMs are good at managing units of hardware resources
• Containers are good at managing units of software
ContainersVirtual Machines
How do Docker containers work? Images and
containers
Dockerfile > Image > Container
• Dockerfile: text file recipe for image
• Image: read-only file system (i.e. template)
• Container: copy of an image (i.e. instance)
The container is what gets run and where apps go
Dockerfile
Runs when container starts
Runs when image is built
Images
Containers
Underneath Docker
• Docker typically uses the Linux container system (i.e. LXC), which can
run apps that run on Linux (now it also uses the new Windows
container system)
• Linux containers isolate processes
• Containers share the host operating system’s kernel - meant to create an
environment without the need for a separate kernel
Docker on Linux Containers
• Docker helps manage containers
• Docker abstracts machine-specific settings relating to networking, storing,
logging, etc.
• Docker makes it easy to create and distribute containers
• Docker allows containers to run on many different machines, with
many different configurations
• 1 process per container philosophy
Docker on Mac and Windows
• Docker runs containers on Linux kernel via virtual machine
• They can now also run on the Windows kernel
Benefits of containers
• Consistent
• Very portable
• Fast to spin up
• Smaller footprint
• Easy to scale
Open Container Initiative
• Docker is a runtime and container format based on the Open
Container Initiative
• Create open industry standards around container formats and
runtime
docker run example.com/org/app:v1.0.0
rkt run example.com/org/app,version=v1.0.0
Windows?
Docker can also use the container system new in Windows Server 2016 and
Windows 10, which can run Windows apps in containers
Source: Docker Blog
Where can I host applications in containers?
• Linux server
• VM on Azure, AWS, etc.
• Container service like AWS Container Service, Azure Container Service
• Many other hosts (Hadoop, etc.)
• Using scheduler/orchestrator like ECS, Kubernetes, Swarm, Mesos
Building & Deploying Overview
• Dev container, big
• Prod container, small
Dev container
- SDK
- Source code
- System files to support development
- Build artifacts
Prod container
- Build artifacts
Fun facts
• Average host runs 7 containers but goes way up
• 40% of Docker adopters are using an orchestrator
• Kubernetes, ECS, Swarm, etc.
Container Ecosystem
Container Management System
Orchestrator
Container Engine
Containerized Applications
Security controls, image security
scanning, centralized management
tools, app lifecycle management,
enterprise management
Scheduling, communication, service
discovery, load balancing, self-
healing, rolling updates, pipeline
management, federation, etc
Runs containers
Application packaged in a standard
way
Docker EE, OpenShift,
control plane
Cluster(s) managed by
Kubernetes, Swarm, Mesos,
Fleet
Docker on Azure/AWS/VM
App with React UI container,
ASP.NET Core API container
What’s it like out there?
What’s it like out there?
Popular images
• Redis: This popular key-value data store is often used as an in-memory database, message queue, or cache.
• Elasticsearch: Full-text search continues to increase in popularity, cracking the top 3 for the first time.
• Registry: 18% of companies running Docker are using Registry, an application for storing and distributing
other Docker images. Registry has been near the top of the list in each edition of this report.
• Postgres: The increasingly popular open source relational database edges out MySQL for the first time in this
ranking.
• MySQL: The most widely used open source database in the world continues to find use in Docker
infrastructure. Adding the MySQL and Postgres numbers, it appears that using Docker to run relational
databases is surprisingly common.
• etcd: The distributed key-value store is used to provide consistent configuration across a Docker cluster.
• Fluentd: This open source "unified logging layer" is designed to decouple data sources from backend data
stores. This is the first time Fluentd has appeared on the list, displacing Logspout from the top 10.
• MongoDB: The widely-used NoSQL datastore.
• RabbitMQ:The open source message broker finds plenty of use in Docker environments.
Benefits of using Docker for development
• Getting an environment running very fast
• Being able to share your environment with others
• Being able to extend your environment very fast and easily (i.e.
adding a Redis server)
• Consistent environments
• You can version development environments
• Development through Production
• Not polluting your computer with frameworks since they are installed
in the containers (git & Docker is all you need!)
You can develop with Docker on:
Docker basics
docker images
docker container ls –a (ps –a)
docker image build -t <yourTag:ImageName> . (docker build …)
docker container run -i -p 80:5000 -v $(pwd):/app -t <yourTag:ImageName>
docker image rm <image name> OLD: (docker rmi ...)
docker container rm $(docker ps –a) OLD: (docker rm ...)
Power clean commands
• Remove stopped containers:
docker rm $(docker ps -a -q)
• Remove all unused containers, volumes, networks and images (both dangling
and unreferenced):
docker system prune NOTE: add -a to remomve unnused images, not just dangling
Additional common commands
docker exec -ti <container ID or name> bash
docker logs <container ID or name>
docker inspect <container ID or name>
• View and manage volumes,
docker volume ls
docker volume inspect <name>
• View and manage networks,
docker network ls
docker network inspect <name>
Docker Compose
• Spin up multiple containers together
• Declare container settings
Common commands:
docker-compose up -d
docker-compose stop
docker-compose down
Other common commands
docker logs <container_name> [--tail 10]
docker exec -it <container_name> sh
docker volume … (ls, inspect, etc)
docker network … (ls, inspect, etc)
Getting ready to develop
1. Install Docker & go to the command line
2. Build an image by creating a Dockerfile & building
3. Create/go into an app directory (create app if needed)
4. Run the container. It will:
1. mount your directory
2. expose port(s)
3. run and watch your app
5. Proceed to develop as usual in your IDE of choice
Lab
Thanks!
@wynv | wyn.vandevanter@excella.com
Next Steps:
• Docker In-Depth, Swarm, Etc Workshop,
https://github.com/jpetazzo/container.training
• Getting Started with Docker Deployment Workshop

Developer workflow with docker

  • 1.
    Developer Workflow using WynVan Devanter @wynv wyn.vandevanter@excella.com https://github.com/excellalabs/docker-workshop-1 Vic Kumar vic.kumar@excella.com
  • 2.
    Cloud Enabling Technologies •Virtualization • Private Platform-as-a-Service • Cloud management software • Automation software • Containers Cloud market: 23 billion in 2017, 39 billion by 2020
  • 3.
    What is Docker? •A VM gives you a OS in a window • A container gives you a file system via background process(es)
  • 4.
    VMs vs Containers •VMs are good at managing units of hardware resources • Containers are good at managing units of software
  • 5.
  • 7.
    How do Dockercontainers work? Images and containers Dockerfile > Image > Container • Dockerfile: text file recipe for image • Image: read-only file system (i.e. template) • Container: copy of an image (i.e. instance) The container is what gets run and where apps go
  • 8.
    Dockerfile Runs when containerstarts Runs when image is built
  • 9.
  • 10.
  • 11.
    Underneath Docker • Dockertypically uses the Linux container system (i.e. LXC), which can run apps that run on Linux (now it also uses the new Windows container system) • Linux containers isolate processes • Containers share the host operating system’s kernel - meant to create an environment without the need for a separate kernel
  • 12.
    Docker on LinuxContainers • Docker helps manage containers • Docker abstracts machine-specific settings relating to networking, storing, logging, etc. • Docker makes it easy to create and distribute containers • Docker allows containers to run on many different machines, with many different configurations • 1 process per container philosophy
  • 13.
    Docker on Macand Windows • Docker runs containers on Linux kernel via virtual machine • They can now also run on the Windows kernel
  • 14.
    Benefits of containers •Consistent • Very portable • Fast to spin up • Smaller footprint • Easy to scale
  • 15.
    Open Container Initiative •Docker is a runtime and container format based on the Open Container Initiative • Create open industry standards around container formats and runtime docker run example.com/org/app:v1.0.0 rkt run example.com/org/app,version=v1.0.0
  • 16.
    Windows? Docker can alsouse the container system new in Windows Server 2016 and Windows 10, which can run Windows apps in containers Source: Docker Blog
  • 17.
    Where can Ihost applications in containers? • Linux server • VM on Azure, AWS, etc. • Container service like AWS Container Service, Azure Container Service • Many other hosts (Hadoop, etc.) • Using scheduler/orchestrator like ECS, Kubernetes, Swarm, Mesos
  • 18.
    Building & DeployingOverview • Dev container, big • Prod container, small Dev container - SDK - Source code - System files to support development - Build artifacts Prod container - Build artifacts
  • 19.
    Fun facts • Averagehost runs 7 containers but goes way up • 40% of Docker adopters are using an orchestrator • Kubernetes, ECS, Swarm, etc.
  • 20.
    Container Ecosystem Container ManagementSystem Orchestrator Container Engine Containerized Applications Security controls, image security scanning, centralized management tools, app lifecycle management, enterprise management Scheduling, communication, service discovery, load balancing, self- healing, rolling updates, pipeline management, federation, etc Runs containers Application packaged in a standard way Docker EE, OpenShift, control plane Cluster(s) managed by Kubernetes, Swarm, Mesos, Fleet Docker on Azure/AWS/VM App with React UI container, ASP.NET Core API container
  • 21.
    What’s it likeout there?
  • 22.
    What’s it likeout there?
  • 23.
    Popular images • Redis:This popular key-value data store is often used as an in-memory database, message queue, or cache. • Elasticsearch: Full-text search continues to increase in popularity, cracking the top 3 for the first time. • Registry: 18% of companies running Docker are using Registry, an application for storing and distributing other Docker images. Registry has been near the top of the list in each edition of this report. • Postgres: The increasingly popular open source relational database edges out MySQL for the first time in this ranking. • MySQL: The most widely used open source database in the world continues to find use in Docker infrastructure. Adding the MySQL and Postgres numbers, it appears that using Docker to run relational databases is surprisingly common. • etcd: The distributed key-value store is used to provide consistent configuration across a Docker cluster. • Fluentd: This open source "unified logging layer" is designed to decouple data sources from backend data stores. This is the first time Fluentd has appeared on the list, displacing Logspout from the top 10. • MongoDB: The widely-used NoSQL datastore. • RabbitMQ:The open source message broker finds plenty of use in Docker environments.
  • 24.
    Benefits of usingDocker for development • Getting an environment running very fast • Being able to share your environment with others • Being able to extend your environment very fast and easily (i.e. adding a Redis server) • Consistent environments • You can version development environments • Development through Production • Not polluting your computer with frameworks since they are installed in the containers (git & Docker is all you need!)
  • 25.
    You can developwith Docker on:
  • 26.
    Docker basics docker images dockercontainer ls –a (ps –a) docker image build -t <yourTag:ImageName> . (docker build …) docker container run -i -p 80:5000 -v $(pwd):/app -t <yourTag:ImageName> docker image rm <image name> OLD: (docker rmi ...) docker container rm $(docker ps –a) OLD: (docker rm ...)
  • 27.
    Power clean commands •Remove stopped containers: docker rm $(docker ps -a -q) • Remove all unused containers, volumes, networks and images (both dangling and unreferenced): docker system prune NOTE: add -a to remomve unnused images, not just dangling
  • 28.
    Additional common commands dockerexec -ti <container ID or name> bash docker logs <container ID or name> docker inspect <container ID or name> • View and manage volumes, docker volume ls docker volume inspect <name> • View and manage networks, docker network ls docker network inspect <name>
  • 29.
    Docker Compose • Spinup multiple containers together • Declare container settings Common commands: docker-compose up -d docker-compose stop docker-compose down
  • 30.
    Other common commands dockerlogs <container_name> [--tail 10] docker exec -it <container_name> sh docker volume … (ls, inspect, etc) docker network … (ls, inspect, etc)
  • 31.
    Getting ready todevelop 1. Install Docker & go to the command line 2. Build an image by creating a Dockerfile & building 3. Create/go into an app directory (create app if needed) 4. Run the container. It will: 1. mount your directory 2. expose port(s) 3. run and watch your app 5. Proceed to develop as usual in your IDE of choice
  • 32.
  • 33.
    Thanks! @wynv | wyn.vandevanter@excella.com NextSteps: • Docker In-Depth, Swarm, Etc Workshop, https://github.com/jpetazzo/container.training • Getting Started with Docker Deployment Workshop

Editor's Notes

  • #27 Downsides: Extra complexity
  • #30 - In the same way, Linux containers (ASP.NET Core)
  • #31 - In the same way, Linux containers (ASP.NET Core)
  • #32 -show images -show all containers
  • #33 -show images -show all containers
  • #34 -show images -show all containers
  • #35 -clean up what is there -show quick running of existing container – with SDK -build a container -run it, stop it. Log in. -change some code and re-run -docker push -clean up -docker-compose
  • #39 -clean up what is there -show quick running of existing container – with SDK -build a container -run it, stop it. Log in. -change some code and re-run -docker push -clean up -docker-compose