Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Docker
Narato DevOps Series
Agenda
 What is docker and why use it
 The basic docker tools
 Docker during development
 Docker during CI and testing...
Not on the agenda
 How do docker or linux containers actually work
What is Docker?
“Docker allows you to package an application with all of its dependencies into a standardized unit for
sof...
What is Docker?
Docker is an opinioned implementation for building, shipping and deploying applications as
standalone cont...
What are docker containers?
Docker containers are a Linux technology!
What are docker containers?
Why?
Why would we want to use them?
Why?
Languages
.NET, NodeJS, Java,
Python. Go, …
Applications
Web Services,
Background Workers,
Databases, …
Libraries
.NE...
Why?
Development
Environment
Production
Environment
Test
Environment
IoT Devices
Cloud
Providers
Virtual
Machines
Shared
H...
Why?
Networking, security, orchestration, oh my
…
Virtual Machines vs Docker
The container perspective
Containers
Many products
Containers
Many transports
Linux Containers
Distro and vendor neutral environment for
the development of Linux container
technologies.
LXC, LXD, …
ht...
Alternatives to Docker
 Linux Containers
https://linuxcontainers.org/
 Flockport
https://www.flockport.com/
 Rocket (Co...
Even Microsoft joins in
 https://azure.microsoft.com/en-us/blog/new-windows-server-containers-and-azure-support-for-
dock...
Docker Tools
Docker Products
docker-machine
Automate Docker provisioning.
docker-machine
docker-machine [command] [machine-name]
docker-machine start default
docker-machine status default
docker-m...
docker engine
Docker Engine runs on Linux to create the
operating environment for your
distributed applications.
docker engine
docker [options] command [arg...]
docker images
docker ps
docker build .
docker run –p “8888:8888” image_name
docker-compose
Docker Compose allows you to define
your multi-container application with all of
its dependencies in a sing...
docker-compose
docker-compose [options] [command] [args]
docker-compose up
docker-compose start
docker-compose stop
docker...
swarm
Docker Swarm provides native clustering
capabilities to turn a group of Docker
engines into a single, virtual Docker...
swarm
Can run as a container on a docker engine
instance.
docker run swarm
Using Docker in development
Docker in the development part of Application Lifecycle Management
Development
FROM node
MAINTAINER Stefan Alaerts <stefan.alaerts@narato.be>
RUN apt-get update -qq && apt-get install -y bu...
Development
https://docs.docker.com/engine/userguide/eng-
image/dockerfile_best-practices/
Use the best practices when aut...
Development
 docker build –t {tag} .
Build images using docker engine.
Development
version: '2'
services:
bus:
image: rabbitmq:3-management
ports:
- "15672:15672"
- "5672:5672"
hostname: eventh...
Development
 docker-compose up
Use docker-compose to run all of your
containers as a single unit.
Tips for Windows users
Don’t suspend your computer while docker-machine is running a
machine in VirtualBox.
Doing so often...
Tips for Windows users
When using volumes, make sure your project folder is inside your
user home directory. (VirtualBox s...
Tips for Linux users
Use the power of the command line to remove all images with one
command:
docker rm `docker ps -aq`
Tips for all users
Use the docker-compose extends functionality.
You can auto-reload your application in development by sh...
Tips for all users
You can access the shell of a running container if you need it.
docker exec –i –t [container_id|contain...
Using Docker after development
Docker in the CI and testing part of Application Lifecycle Management
Extending development flow
Docker Machine (Windows, OSX)
Docker Engine
Docker Compose
Application Lifecycle Management
https://blog.docker.com/2015/09/docker-hub-2-0/
DevOps with Docker
http://thenewstack.io/how-docker-fits-into-the-devops-ecosystem/
DevOps with Docker
https://dzone.com/articles/docker-hub-20-integration-with-the-cloudbees-jenki
Tools for production
 Docker Cloud (previously Tutum)
 Rancher
 Deis
http://deis.io/
 Atomic
http://www.projectatomic....
Example: deploying a NodeJS blog
 docker login --username=salaerts --email=stefan.alaerts@gmail.com
 docker build –t sal...
Example: deploying a NodeJS blog
 git push origin master
 Docker Hub kicks off an automated build on each push
Upcoming SlideShare
Loading in …5
×

Docker

262 views

Published on

Introduction to Docker

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Docker

  1. 1. Docker Narato DevOps Series
  2. 2. Agenda  What is docker and why use it  The basic docker tools  Docker during development  Docker during CI and testing  Docker in production  Q & A
  3. 3. Not on the agenda  How do docker or linux containers actually work
  4. 4. What is Docker? “Docker allows you to package an application with all of its dependencies into a standardized unit for software development.”
  5. 5. What is Docker? Docker is an opinioned implementation for building, shipping and deploying applications as standalone containers.
  6. 6. What are docker containers? Docker containers are a Linux technology!
  7. 7. What are docker containers?
  8. 8. Why? Why would we want to use them?
  9. 9. Why? Languages .NET, NodeJS, Java, Python. Go, … Applications Web Services, Background Workers, Databases, … Libraries .NET Framework, ExpressJS, Django, Ruby On Rails, … Modern architectures have a diverse ecosystem. More sources to handle.
  10. 10. Why? Development Environment Production Environment Test Environment IoT Devices Cloud Providers Virtual Machines Shared Hosting CI Environment Linux Windows OS X QA Environment Bare Metal More targets to handle.
  11. 11. Why? Networking, security, orchestration, oh my …
  12. 12. Virtual Machines vs Docker
  13. 13. The container perspective
  14. 14. Containers Many products
  15. 15. Containers Many transports
  16. 16. Linux Containers Distro and vendor neutral environment for the development of Linux container technologies. LXC, LXD, … https://linuxcontainers.org/
  17. 17. Alternatives to Docker  Linux Containers https://linuxcontainers.org/  Flockport https://www.flockport.com/  Rocket (CoreOS) https://github.com/coreos/rkt  Drawbridge (Microsoft) http://research.microsoft.com/en-us/projects/drawbridge/  LXD (Ubuntu/OpenStack) http://www.ubuntu.com/cloud/lxd  Windows Containers https://msdn.microsoft.com/en- us/virtualization/windowscontainers/quick_start/manage_docker?f=255&MSPPError=-2147217396
  18. 18. Even Microsoft joins in  https://azure.microsoft.com/en-us/blog/new-windows-server-containers-and-azure-support-for- docker/  https://azure.microsoft.com/en-us/blog/containers-docker-windows-and-trends/  https://msdn.microsoft.com/en- us/virtualization/windowscontainers/quick_start/manage_docker?f=255&MSPPError=-2147217396
  19. 19. Docker Tools
  20. 20. Docker Products
  21. 21. docker-machine Automate Docker provisioning.
  22. 22. docker-machine docker-machine [command] [machine-name] docker-machine start default docker-machine status default docker-machine env default
  23. 23. docker engine Docker Engine runs on Linux to create the operating environment for your distributed applications.
  24. 24. docker engine docker [options] command [arg...] docker images docker ps docker build . docker run –p “8888:8888” image_name
  25. 25. docker-compose Docker Compose allows you to define your multi-container application with all of its dependencies in a single file, then spin your application up in a single command.
  26. 26. docker-compose docker-compose [options] [command] [args] docker-compose up docker-compose start docker-compose stop docker-compose build docker-compose ps docker-compose scale service=2
  27. 27. swarm Docker Swarm provides native clustering capabilities to turn a group of Docker engines into a single, virtual Docker Engine.
  28. 28. swarm Can run as a container on a docker engine instance. docker run swarm
  29. 29. Using Docker in development Docker in the development part of Application Lifecycle Management
  30. 30. Development FROM node MAINTAINER Stefan Alaerts <stefan.alaerts@narato.be> RUN apt-get update -qq && apt-get install -y build-essential RUN mkdir /eventhandler-api-service COPY . /eventhandler-api-service/ WORKDIR /eventhandler-api-service ENV NODE_ENV production RUN npm install EXPOSE 8888 CMD node lib/index.js Use a Dockerfile to describe how docker should build an image for your application. The resulting image should preferably be self-contained.
  31. 31. Development https://docs.docker.com/engine/userguide/eng- image/dockerfile_best-practices/ Use the best practices when authoring Dockerfiles.
  32. 32. Development  docker build –t {tag} . Build images using docker engine.
  33. 33. Development version: '2' services: bus: image: rabbitmq:3-management ports: - "15672:15672" - "5672:5672" hostname: eventhandler-bus api: build: ./src/api ports: - "8888:8888" hostname: eventhandler-api environment: - CONFIGURATION_URL=eventhandler-configuration - CONFIGURATION_PORT=4050 - BUS_URL=eventhandler-bus command: nodemon -L lib/index.js Use a docker-compose.yml file to describe configuration for multiple containers.
  34. 34. Development  docker-compose up Use docker-compose to run all of your containers as a single unit.
  35. 35. Tips for Windows users Don’t suspend your computer while docker-machine is running a machine in VirtualBox. Doing so often breaks networking.
  36. 36. Tips for Windows users When using volumes, make sure your project folder is inside your user home directory. (VirtualBox shared folders limitation.)
  37. 37. Tips for Linux users Use the power of the command line to remove all images with one command: docker rm `docker ps -aq`
  38. 38. Tips for all users Use the docker-compose extends functionality. You can auto-reload your application in development by sharing your code using volumes while embedding the code in production. Most production tools (Docker Cloud, Rancher, …) also support extending compose configurations.
  39. 39. Tips for all users You can access the shell of a running container if you need it. docker exec –i –t [container_id|container_name] bash
  40. 40. Using Docker after development Docker in the CI and testing part of Application Lifecycle Management
  41. 41. Extending development flow Docker Machine (Windows, OSX) Docker Engine Docker Compose
  42. 42. Application Lifecycle Management https://blog.docker.com/2015/09/docker-hub-2-0/
  43. 43. DevOps with Docker http://thenewstack.io/how-docker-fits-into-the-devops-ecosystem/
  44. 44. DevOps with Docker https://dzone.com/articles/docker-hub-20-integration-with-the-cloudbees-jenki
  45. 45. Tools for production  Docker Cloud (previously Tutum)  Rancher  Deis http://deis.io/  Atomic http://www.projectatomic.io/
  46. 46. Example: deploying a NodeJS blog  docker login --username=salaerts --email=stefan.alaerts@gmail.com  docker build –t salaerts/blog .  docker push salaerts/blog
  47. 47. Example: deploying a NodeJS blog  git push origin master  Docker Hub kicks off an automated build on each push

×