SlideShare a Scribd company logo
1 of 11
Download to read offline
Docker in Action
Alper Kanat <alper.kanat@commencis.com>
Let’s go back in time a bit...
Please take a look at the previous keynote to have a brief introduction to Docker!
https://www.slideshare.net/AlperKanat/next-in-virtualization-era-containerization-docker
After Virtualbox & homebrew installation...
$ brew install docker
$ brew install docker-machine
$ docker-machine create -d virtualbox --virtualbox-memory "2048" default
Image cache does not exist, creating it at /Users/kanata/.docker/machine/cache...
No default boot2docker iso found locally, downloading the latest release...
Downloading https://github.com/boot2docker/boot2docker/releases/download/v1.8.3/boot2docker.iso to
/Users/kanata/.docker/machine/cache/boot2docker.iso...
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: docker-machine env default
$ docker-machine env default
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="/Users/kanata/.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"
# Run this command to configure your shell:
# eval "$(docker-machine env default)"
$ eval "$(docker-machine env default)"
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
boot2docker
$ docker run --name tunix -it --rm ubuntu /bin/echo 'Hello World!'
Hello World!
$
Checkout docker manual (docker run --help) or its website for other arguments.
Hello World
Assigns the given name to
container for later use
Makes container session interactive for
testing or preperation
Deletes container when the
working process quits
Container image to use.
Usually suffixed by version
(e.g.: ubuntu:16.04)
The command that the process will be
executed by. This is usually omitted for
production containers.
The output of the running
process.
Dockerfile
FROM ubuntu:16.04
MAINTAINER Alper Kanat <alper.kanat@commencis.com>
RUN sed -i "s/archive.ubuntu/tr.archive.ubuntu/g" /etc/apt/sources.list
RUN apt-get -qq update
RUN apt-get -qqy upgrade
RUN apt-get install -qqy nodejs nodejs-legacy npm git
RUN npm install -g bower gulp
ADD . /srv
WORKDIR /srv
RUN npm install
RUN bower install --allow-root
RUN gulp clean build
ENV NODE_ENV production
EXPOSE 3000
CMD ["./app.js"]
Dockerfile (cont’d)
Notes about Dockerfile
● Dockerfile is usually placed inside the root folder of the project
● Multiple Dockerfile’s can be placed within a project
● Dockerfile is being used for generating base/container images
● Each statement in Dockerfile are committed in order, hence yield new layers of the resulting
image.
● Image layers are reusable so we should try our best to prevent changes to Dockerfile and add new
statements to the bottom of Dockerfile whenever possible. If a layer changes, all layers after
that one will be regenerated, causing an even larger image.
● Usually a base image is being used for each new image. A “Hello World Spring Boot” app can be
based on top of a Java image. However a base Ubuntu image can be used to start from scratch.
● You should have a clear understanding of network ports & volume usage before writing a new
Dockerfile.
● Consider reading the reference manual to learn more about writing Dockerfile’s.
Spring Boot
Hello World App
Demo 1
In our sandbox environment, we have “s1” (sandbox-1) & “s2” (sandbox-2) configured as Docker servers. We use
them to deploy & run your containers to the sandbox environment just like we do for any app. The remote docker
server is determined via environment variables.
$ export DOCKER_HOST=tcp://s1.sandbox.company.com:2375
$ export DOCKER_TLS_VERIFY=
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8248fe49b1d2 tunix/tomcat:8.0 "/run.sh" 5 weeks ago Up 5 weeks 0.0.0.0:8081->8080/tcp tomcat8
b25a77110d2c tunix/tomcat-java8:8.0 "/run.sh" 5 weeks ago Up 5 weeks 0.0.0.0:8082->8080/tcp tomcat8-j8
7ad53d9921bf tunix/tomcat:7.0 "/run.sh" 5 weeks ago Up 2 days 0.0.0.0:8080->8080/tcp tomcat7
There are 2 ways to deploy containers to remote docker servers. Either build container image on the server itself or copy the image onto
the server:
$ docker save -o ~/Desktop/my-image-name.tar my-image-name
$ scp ~/Desktop/my-image-name.tar s1.sandbox.company.com:
$ ssh s1.sandbox.company.com
$ docker load -i ~/my-image-name.tar
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
tunix/tomcat-java8 8.0 ac81155e8a00 5 weeks ago 573.2 MB
tunix/tomcat 7.0 1ab892df6239 5 weeks ago 863.1 MB
tunix/tomcat 8.0 25fd96065ad8 5 weeks ago 539.4 MB
Deployment (sandbox)
Docker Hub
$ docker search mongodb
$ docker pull ubuntu:16.04
$ docker login
$ docker push tunix/tomcat-java8:8.0
● So we can create custom container images, deploy and reuse
● Supports auto builds from github & bitbucket
Docker Services (tutum)
● A commit to your github ends up as a container in your services: Poor Man’s AWS!
● Compose your architecture with stack files for auto creation & management of containers
● Auto scaling (even with labels) allows you to span over single/multiple machines
Questions?
(Thank you!)

More Related Content

What's hot

Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in developmentAdam Culp
 
Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and AgentRanjit Avasarala
 
Using Docker with Puppet - PuppetConf 2014
Using Docker with Puppet - PuppetConf 2014Using Docker with Puppet - PuppetConf 2014
Using Docker with Puppet - PuppetConf 2014Puppet
 
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...Puppet
 
Automating Docker Containers with Puppet 2014 10-13
Automating Docker Containers with Puppet 2014 10-13Automating Docker Containers with Puppet 2014 10-13
Automating Docker Containers with Puppet 2014 10-13kylog
 
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHDeploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHErica Windisch
 
Vagrant and docker
Vagrant and dockerVagrant and docker
Vagrant and dockerDuckDuckGo
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleRobert Reiz
 
Docker puppetcamp london 2013
Docker puppetcamp london 2013Docker puppetcamp london 2013
Docker puppetcamp london 2013Tomas Doran
 
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05dotCloud
 
Deploying an application with Chef and Docker
Deploying an application with Chef and DockerDeploying an application with Chef and Docker
Deploying an application with Chef and DockerDaniel Ku
 
Vagrant crash course
Vagrant crash courseVagrant crash course
Vagrant crash courseMarcus Deglos
 
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3 Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3 Puppet
 
Vagrant-Overview
Vagrant-OverviewVagrant-Overview
Vagrant-OverviewCrifkin
 
Demystifying Container Escapes
Demystifying Container EscapesDemystifying Container Escapes
Demystifying Container EscapesVaibhav Gupta
 

What's hot (20)

Vagrant
VagrantVagrant
Vagrant
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in development
 
DevOps: Docker Workshop
DevOps: Docker WorkshopDevOps: Docker Workshop
DevOps: Docker Workshop
 
Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and Agent
 
Using Docker with Puppet - PuppetConf 2014
Using Docker with Puppet - PuppetConf 2014Using Docker with Puppet - PuppetConf 2014
Using Docker with Puppet - PuppetConf 2014
 
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
 
Automating Docker Containers with Puppet 2014 10-13
Automating Docker Containers with Puppet 2014 10-13Automating Docker Containers with Puppet 2014 10-13
Automating Docker Containers with Puppet 2014 10-13
 
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHDeploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
 
Vagrant and docker
Vagrant and dockerVagrant and docker
Vagrant and docker
 
Introduction to Vagrant
Introduction to VagrantIntroduction to Vagrant
Introduction to Vagrant
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
 
Docker puppetcamp london 2013
Docker puppetcamp london 2013Docker puppetcamp london 2013
Docker puppetcamp london 2013
 
Vagrant + Docker
Vagrant + DockerVagrant + Docker
Vagrant + Docker
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05
 
Deploying an application with Chef and Docker
Deploying an application with Chef and DockerDeploying an application with Chef and Docker
Deploying an application with Chef and Docker
 
Vagrant crash course
Vagrant crash courseVagrant crash course
Vagrant crash course
 
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3 Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3
 
Vagrant-Overview
Vagrant-OverviewVagrant-Overview
Vagrant-Overview
 
Demystifying Container Escapes
Demystifying Container EscapesDemystifying Container Escapes
Demystifying Container Escapes
 

Similar to Docker in Action

Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Ben Hall
 
Learn docker in 90 minutes
Learn docker in 90 minutesLearn docker in 90 minutes
Learn docker in 90 minutesLarry Cai
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortalsHenryk Konsek
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshopRuncy Oommen
 
Streamline your development environment with docker
Streamline your development environment with dockerStreamline your development environment with docker
Streamline your development environment with dockerGiacomo Bagnoli
 
Docker Containers: Developer’s experience and building robust developer envir...
Docker Containers: Developer’s experience and building robust developer envir...Docker Containers: Developer’s experience and building robust developer envir...
Docker Containers: Developer’s experience and building robust developer envir...Future Cloud Summit
 
Docker, Kubernetes, and Google Cloud
Docker, Kubernetes, and Google CloudDocker, Kubernetes, and Google Cloud
Docker, Kubernetes, and Google CloudSamuel Chow
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerGuido Schmutz
 
Introduction to Docker - Learning containerization XP conference 2016
Introduction to Docker - Learning containerization  XP conference 2016Introduction to Docker - Learning containerization  XP conference 2016
Introduction to Docker - Learning containerization XP conference 2016XP Conference India
 
Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers Will Hall
 
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz LachJDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz LachPROIDEA
 
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth RushgroveThe Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth RushgroveDocker, Inc.
 

Similar to Docker in Action (20)

Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)
 
Learn docker in 90 minutes
Learn docker in 90 minutesLearn docker in 90 minutes
Learn docker in 90 minutes
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortals
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshop
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
How to _docker
How to _dockerHow to _docker
How to _docker
 
Docker
DockerDocker
Docker
 
Docker
DockerDocker
Docker
 
Streamline your development environment with docker
Streamline your development environment with dockerStreamline your development environment with docker
Streamline your development environment with docker
 
Docker Containers: Developer’s experience and building robust developer envir...
Docker Containers: Developer’s experience and building robust developer envir...Docker Containers: Developer’s experience and building robust developer envir...
Docker Containers: Developer’s experience and building robust developer envir...
 
Docker, Kubernetes, and Google Cloud
Docker, Kubernetes, and Google CloudDocker, Kubernetes, and Google Cloud
Docker, Kubernetes, and Google Cloud
 
Learning Docker with Thomas
Learning Docker with ThomasLearning Docker with Thomas
Learning Docker with Thomas
 
Docker
DockerDocker
Docker
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker Container
 
A Hands-on Introduction to Docker
A Hands-on Introduction to DockerA Hands-on Introduction to Docker
A Hands-on Introduction to Docker
 
Introduction to Docker - Learning containerization XP conference 2016
Introduction to Docker - Learning containerization  XP conference 2016Introduction to Docker - Learning containerization  XP conference 2016
Introduction to Docker - Learning containerization XP conference 2016
 
Docker From Scratch
Docker From ScratchDocker From Scratch
Docker From Scratch
 
Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers
 
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz LachJDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
 
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth RushgroveThe Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
 

Recently uploaded

What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 

Recently uploaded (20)

What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 

Docker in Action

  • 1. Docker in Action Alper Kanat <alper.kanat@commencis.com>
  • 2. Let’s go back in time a bit... Please take a look at the previous keynote to have a brief introduction to Docker! https://www.slideshare.net/AlperKanat/next-in-virtualization-era-containerization-docker
  • 3. After Virtualbox & homebrew installation... $ brew install docker $ brew install docker-machine $ docker-machine create -d virtualbox --virtualbox-memory "2048" default Image cache does not exist, creating it at /Users/kanata/.docker/machine/cache... No default boot2docker iso found locally, downloading the latest release... Downloading https://github.com/boot2docker/boot2docker/releases/download/v1.8.3/boot2docker.iso to /Users/kanata/.docker/machine/cache/boot2docker.iso... Creating VirtualBox VM... Creating SSH key... Starting VirtualBox VM... Starting VM... To see how to connect Docker to this machine, run: docker-machine env default $ docker-machine env default export DOCKER_TLS_VERIFY="1" export DOCKER_HOST="tcp://192.168.99.100:2376" export DOCKER_CERT_PATH="/Users/kanata/.docker/machine/machines/default" export DOCKER_MACHINE_NAME="default" # Run this command to configure your shell: # eval "$(docker-machine env default)" $ eval "$(docker-machine env default)" $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES boot2docker
  • 4. $ docker run --name tunix -it --rm ubuntu /bin/echo 'Hello World!' Hello World! $ Checkout docker manual (docker run --help) or its website for other arguments. Hello World Assigns the given name to container for later use Makes container session interactive for testing or preperation Deletes container when the working process quits Container image to use. Usually suffixed by version (e.g.: ubuntu:16.04) The command that the process will be executed by. This is usually omitted for production containers. The output of the running process.
  • 5. Dockerfile FROM ubuntu:16.04 MAINTAINER Alper Kanat <alper.kanat@commencis.com> RUN sed -i "s/archive.ubuntu/tr.archive.ubuntu/g" /etc/apt/sources.list RUN apt-get -qq update RUN apt-get -qqy upgrade RUN apt-get install -qqy nodejs nodejs-legacy npm git RUN npm install -g bower gulp ADD . /srv WORKDIR /srv RUN npm install RUN bower install --allow-root RUN gulp clean build ENV NODE_ENV production EXPOSE 3000 CMD ["./app.js"]
  • 6. Dockerfile (cont’d) Notes about Dockerfile ● Dockerfile is usually placed inside the root folder of the project ● Multiple Dockerfile’s can be placed within a project ● Dockerfile is being used for generating base/container images ● Each statement in Dockerfile are committed in order, hence yield new layers of the resulting image. ● Image layers are reusable so we should try our best to prevent changes to Dockerfile and add new statements to the bottom of Dockerfile whenever possible. If a layer changes, all layers after that one will be regenerated, causing an even larger image. ● Usually a base image is being used for each new image. A “Hello World Spring Boot” app can be based on top of a Java image. However a base Ubuntu image can be used to start from scratch. ● You should have a clear understanding of network ports & volume usage before writing a new Dockerfile. ● Consider reading the reference manual to learn more about writing Dockerfile’s.
  • 8. In our sandbox environment, we have “s1” (sandbox-1) & “s2” (sandbox-2) configured as Docker servers. We use them to deploy & run your containers to the sandbox environment just like we do for any app. The remote docker server is determined via environment variables. $ export DOCKER_HOST=tcp://s1.sandbox.company.com:2375 $ export DOCKER_TLS_VERIFY= $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8248fe49b1d2 tunix/tomcat:8.0 "/run.sh" 5 weeks ago Up 5 weeks 0.0.0.0:8081->8080/tcp tomcat8 b25a77110d2c tunix/tomcat-java8:8.0 "/run.sh" 5 weeks ago Up 5 weeks 0.0.0.0:8082->8080/tcp tomcat8-j8 7ad53d9921bf tunix/tomcat:7.0 "/run.sh" 5 weeks ago Up 2 days 0.0.0.0:8080->8080/tcp tomcat7 There are 2 ways to deploy containers to remote docker servers. Either build container image on the server itself or copy the image onto the server: $ docker save -o ~/Desktop/my-image-name.tar my-image-name $ scp ~/Desktop/my-image-name.tar s1.sandbox.company.com: $ ssh s1.sandbox.company.com $ docker load -i ~/my-image-name.tar $ docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE tunix/tomcat-java8 8.0 ac81155e8a00 5 weeks ago 573.2 MB tunix/tomcat 7.0 1ab892df6239 5 weeks ago 863.1 MB tunix/tomcat 8.0 25fd96065ad8 5 weeks ago 539.4 MB Deployment (sandbox)
  • 9. Docker Hub $ docker search mongodb $ docker pull ubuntu:16.04 $ docker login $ docker push tunix/tomcat-java8:8.0 ● So we can create custom container images, deploy and reuse ● Supports auto builds from github & bitbucket
  • 10. Docker Services (tutum) ● A commit to your github ends up as a container in your services: Poor Man’s AWS! ● Compose your architecture with stack files for auto creation & management of containers ● Auto scaling (even with labels) allows you to span over single/multiple machines