Introduction The pipeline The environment The images The problems Finish
Using Docker in CI process
Applied Docker
G. Godlewski
March 16, 2016
Introduction The pipeline The environment The images The problems Finish
Author
About me
Programming, karate, music and cheese making.
Currently working for SMT Software Services
Introduction The pipeline The environment The images The problems Finish
The background
Long time ago, in a galaxy far, far away...
Introduction The pipeline The environment The images The problems Finish
The background
Introduction The pipeline The environment The images The problems Finish
The background
Scope of automation
Unit tests
Functional tests
Integration tests
Quality checks (nightly build, code coverage, phpmd, phpcs,
jshint, jslint, ...)
Deployments
One should constantly search for spots where time could be saved
Introduction The pipeline The environment The images The problems Finish
Definitions
Continuous Integration
Martin Fowler:
Continuous Integration is a software development
practice where members of a team integrate their
work frequently, usually each person integrates at least
daily - leading to multiple integrations per day. Each
integration is verified by an automated build (including
test) to detect integration errors as quickly as possible.
Introduction The pipeline The environment The images The problems Finish
Definitions
Continuous Delivery
Martin Fowler:
A common question we hear is “what is the difference
between Continuous Delivery and Continuous
Deployment?” Both terms are similar and were coined
around the same time. I see the difference as a business
decision about frequency of deployment into production.
Continuous Delivery is about keeping your application
in a state where it is always able to deploy into
production. Continuous Deployment is actually
deploying every change into production, every day or
more frequently.
Introduction The pipeline The environment The images The problems Finish
Product
The point of view
Introduction The pipeline The environment The images The problems Finish
Process
The process
Building - parts put together, diagnostics and verification,
removal of unnecessary parts
Packaging - a ready product is being put into a package
(container)
Delivery - the whole package is shipped to the client in a
clearly defined manner
Each of the stages has a clear I/O definition
Introduction The pipeline The environment The images The problems Finish
Process
Building up a complete solution
In case of a product composed from several components (eg.
complex system) we could use the analogy of buying kitchen
furniture.
All packages contain components that fulfill a defined set of
criteria
We know how the components should be connected
We know how the components should be placed within
client’s infrastructure (kitchen)
Don’t dismiss the power of analogy!
Introduction The pipeline The environment The images The problems Finish
Warming up!
What will we use Docker for
Performing CI builds within isolated containers (docker in
docker, sic!)
Providing the package for the product in which will it be
further distributed
Running our applications
Introduction The pipeline The environment The images The problems Finish
Warming up!
Introduction The pipeline The environment The images The problems Finish
Warming up!
Getting ready
1 Ensure the right kernel version (starting from 3.10!)
2 Ensure you have all required kernel modules (aufs,
devicemapper etc - depends on the distribution)
3 Latest docker-engine installed
4 Latest docker-compose installed
Introduction The pipeline The environment The images The problems Finish
Additional tools
Ansible
What for?
Describe how the application should be delivered (deployment
to server)
Configuration management
Why?
Great documentation
Huge amount of modules - I didn’t have to build my own yet!
Introduction The pipeline The environment The images The problems Finish
Own Docker Hub
Docker Hub
hub:
restart: always
image: registry:2
ports:
- "5000:5000"
environment:
TERM: linux
REGISTRY_HTTP_TLS_CERTIFICATE: :)
REGISTRY_HTTP_TLS_KEY: :)
REGISTRY_AUTH: htpasswd
REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
volumes:
- "/home/docker-distro/registry/data:/var/lib/registry"
- "/etc/ssl/certs:/certs"
- "/etc/ssl/private:/keys"
- "/home/docker-distro/registry/auth:/auth"
Hint
Keep security in mind!
Introduction The pipeline The environment The images The problems Finish
The CI Server
TeamCity
Free version provides:
3 build agents
20 build configurations
Broad configuration capabilities (build parameters,
configuration templates, defining dependencies etc)
Introduction The pipeline The environment The images The problems Finish
Understanding CI
Build Server and Build Agents
Introduction The pipeline The environment The images The problems Finish
Customs
Special forces
Introduction The pipeline The environment The images The problems Finish
Customs
Custom Agent
FROM sjoerdmulder/teamcity-agent:latest
MAINTAINER Grzegorz Godlewski <grzegorz@sorcerystudio.com>
RUN apt-get -y install software-properties-common
RUN apt-add-repository ppa:ansible/ansible
RUN apt-get update
RUN apt-get -y install ansible
COPY ./keys/id_rsa /home/teamcity/.ssh/id_rsa
RUN chown -R teamcity:teamcity /home/teamcity/.ssh
ADD docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod a+x docker-entrypoint.sh
Introduction The pipeline The environment The images The problems Finish
Customs
Extending the images
Introduction The pipeline The environment The images The problems Finish
Implementation
TeamCity Server
server:
image: "sjoerdmulder/teamcity:latest"
ports:
- "8111:8111"
volumes:
- "/home/teamcity/server/data:/var/lib/teamcity"
environment:
TERM: linux
Introduction The pipeline The environment The images The problems Finish
Implementation
TeamCity Agent
agent:
image: "my-own-hub/teamcity-agent:latest"
ports:
- "9090:9090"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock" # docker in docker
- "/usr/bin/docker:/usr/bin/docker"
- "/usr/bin/docker:/usr/local/bin/docker"
- "/home/teamcity/agent/work:/opt/buildAgent/work" # work directories
- "/home/teamcity/agent/composer:/opt/composer/cache" # composer cache
- "/home/teamcity/agent/docker:/home/teamcity/.docker" # hub auth keys
environment:
TERM: linux
TEAMCITY_SERVER: "http://teamcity_server:8111" # your server
TEAMCITY_AGENT_NAME: "Alpha" # readable name
AGENT_HOME_ON_HOST: "/home/teamcity/agent" # custom ENV for runtime
Introduction The pipeline The environment The images The problems Finish
Implementation
The flow
1 Run build in dev image
2 Package using dist image
3 Distribute using Ansible and docker-compose
Introduction The pipeline The environment The images The problems Finish
It’s never that easy
Not so easy...
Cleaning up
CI process performance
Proper kernel modules
Dynamically linked modules
Race conditions
Introduction The pipeline The environment The images The problems Finish
It’s never that easy
https://github.com/docker/docker/issues/4036
Introduction The pipeline The environment The images The problems Finish
It’s never that easy
https://github.com/docker/docker/issues/4036
If you’re using the devicemapper diver, make sure that Udev Sync
Supported is set to true.
Introduction The pipeline The environment The images The problems Finish
Questions?
Introduction The pipeline The environment The images The problems Finish
Thank you!
http://linkedin.com/in/ggodlewski
grzegorz@sorcerystudio.com
@GGodlewski

More Related Content

PDF
PuppetConf 2016: Delivering Premium Quality Modules: Using Beaker and VMpoole...
PDF
Jfokus 2017 - The DevOps Disaster
PDF
PuppetConf 2016: Implementing Puppet within a Complex Enterprise – Jerry Caup...
PDF
Pimp your Continuous Delivery Pipeline with Jenkins workflow (W-JAX 14)
KEY
Continuous Integration & Drupal
PPTX
Delivery Pipeline as Code: using Jenkins 2.0 Pipeline
PDF
ContainerCon - Test Driven Infrastructure
PDF
Devops interview-questions-PDF
PuppetConf 2016: Delivering Premium Quality Modules: Using Beaker and VMpoole...
Jfokus 2017 - The DevOps Disaster
PuppetConf 2016: Implementing Puppet within a Complex Enterprise – Jerry Caup...
Pimp your Continuous Delivery Pipeline with Jenkins workflow (W-JAX 14)
Continuous Integration & Drupal
Delivery Pipeline as Code: using Jenkins 2.0 Pipeline
ContainerCon - Test Driven Infrastructure
Devops interview-questions-PDF

What's hot (20)

PPT
Getting Started With Jenkins And Drupal
PDF
CI/CD 101
PDF
Drupal Continuous Integration (European Drupal Days 2015)
PPTX
Easy Cross-Platform PowerShell Automation with Puppet Bolt
PDF
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
PDF
Building an Extensible, Resumable DSL on Top of Apache Groovy
PDF
Jenkins to Gitlab - Intelligent Build-Pipelines
PPTX
Patterns & Antipatterns in Docker Image Lifecycle
PDF
JavaCro'14 - Continuous delivery of Java EE applications with Jenkins and Doc...
PDF
Scaling Up Lookout
PPTX
Jenkins days workshop pipelines - Eric Long
PPTX
Provisioning environments. A simplistic approach
PPTX
DevOps Interview Questions Part - 2 | Devops Interview Questions And Answers ...
PDF
CI and CD Across the Enterprise with Jenkins (devops.com Nov 2014)
PDF
Voxxed Luxembourd 2016 Jenkins 2.0 et Pipeline as code
PPTX
What is Puppet? | How Puppet Works? | Puppet Tutorial For Beginners | DevOps ...
PPTX
Devops interview questions 2 www.bigclasses.com
PDF
PuppetConf 2016: Continuous Delivery and DevOps with Jenkins and Puppet Enter...
PPTX
Automated Infrastructure Testing
KEY
Distributed Version Control Systems
Getting Started With Jenkins And Drupal
CI/CD 101
Drupal Continuous Integration (European Drupal Days 2015)
Easy Cross-Platform PowerShell Automation with Puppet Bolt
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Building an Extensible, Resumable DSL on Top of Apache Groovy
Jenkins to Gitlab - Intelligent Build-Pipelines
Patterns & Antipatterns in Docker Image Lifecycle
JavaCro'14 - Continuous delivery of Java EE applications with Jenkins and Doc...
Scaling Up Lookout
Jenkins days workshop pipelines - Eric Long
Provisioning environments. A simplistic approach
DevOps Interview Questions Part - 2 | Devops Interview Questions And Answers ...
CI and CD Across the Enterprise with Jenkins (devops.com Nov 2014)
Voxxed Luxembourd 2016 Jenkins 2.0 et Pipeline as code
What is Puppet? | How Puppet Works? | Puppet Tutorial For Beginners | DevOps ...
Devops interview questions 2 www.bigclasses.com
PuppetConf 2016: Continuous Delivery and DevOps with Jenkins and Puppet Enter...
Automated Infrastructure Testing
Distributed Version Control Systems
Ad

Viewers also liked (20)

PDF
LES ANNEES 1960 EN FRANCE ET EN ITALIE
PDF
CI oraz CD w złożonym projekcie o małym budżecie
PDF
Achieving CI/CD with Kubernetes
PDF
DOC
Balie Mona Curriculum Vitae
PPTX
Stress and reproduction
PPTX
POL 215 tutors Absolute Tutors / pol215tutors.com
PDF
Future of data center french
PDF
Presentazione Club4business
PPTX
Question 3
PDF
9781119101987RetailNetworksForDummies_15954 (1)
PPTX
Flick Film FestivalInternship
PPTX
BVPresentation
PDF
LTRSEC-2017-LG
PPTX
Nowe normy kontroli w instytucjach finansowych
PPTX
Hero moto corp km
PDF
 LE FEMINISME EN FRANCE E...
PDF
Unofficial Transcript
PPTX
klinik medika edukasi PJK
PPTX
Presentation to Corporate-chain business (1)
LES ANNEES 1960 EN FRANCE ET EN ITALIE
CI oraz CD w złożonym projekcie o małym budżecie
Achieving CI/CD with Kubernetes
Balie Mona Curriculum Vitae
Stress and reproduction
POL 215 tutors Absolute Tutors / pol215tutors.com
Future of data center french
Presentazione Club4business
Question 3
9781119101987RetailNetworksForDummies_15954 (1)
Flick Film FestivalInternship
BVPresentation
LTRSEC-2017-LG
Nowe normy kontroli w instytucjach finansowych
Hero moto corp km
 LE FEMINISME EN FRANCE E...
Unofficial Transcript
klinik medika edukasi PJK
Presentation to Corporate-chain business (1)
Ad

Similar to Using Docker in CI process (20)

PDF
Continuos Integration and Delivery: from Zero to Hero with TeamCity, Docker a...
PPTX
Continuous Integration & Development with Gitlab
PDF
ContainerDays Boston 2015: "Continuous Delivery with Containers" (Nick Gauthier)
PPTX
Using Docker EE in a CI/CD Workflow
PPTX
The eBay-Way Meetup IL - CI/CD with Microservices
PDF
Continuous Integration: How I stopped guessing if that merge was bad
PDF
Streamlining Agile Linux Development with Docker and RHEL Atomic
PPTX
SDLC Using Docker for Fun and Profit
PDF
Portable CI wGitLab and Github led by Gavin Pickin.pdf
PDF
Building a CI/CD Pipeline for PHP apps
PDF
Continuous Integration/Deployment with Gitlab CI
PDF
Docker and Puppet for Continuous Integration
PDF
Docker Meetup at Docker HQ: Docker Cloud
PDF
Getting to Walk with DevOps
PDF
Continuous Integration from server to cloud
PDF
ci cd presentation What is CI/CD?Continuous Integration
PPTX
PPTX
CICD Pipeline - AWS Azure
PDF
Cloud continuous integration- A distributed approach using distinct services
ODP
Continous integration
Continuos Integration and Delivery: from Zero to Hero with TeamCity, Docker a...
Continuous Integration & Development with Gitlab
ContainerDays Boston 2015: "Continuous Delivery with Containers" (Nick Gauthier)
Using Docker EE in a CI/CD Workflow
The eBay-Way Meetup IL - CI/CD with Microservices
Continuous Integration: How I stopped guessing if that merge was bad
Streamlining Agile Linux Development with Docker and RHEL Atomic
SDLC Using Docker for Fun and Profit
Portable CI wGitLab and Github led by Gavin Pickin.pdf
Building a CI/CD Pipeline for PHP apps
Continuous Integration/Deployment with Gitlab CI
Docker and Puppet for Continuous Integration
Docker Meetup at Docker HQ: Docker Cloud
Getting to Walk with DevOps
Continuous Integration from server to cloud
ci cd presentation What is CI/CD?Continuous Integration
CICD Pipeline - AWS Azure
Cloud continuous integration- A distributed approach using distinct services
Continous integration

Recently uploaded (20)

PDF
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
PDF
zbrain.ai-Scope Key Metrics Configuration and Best Practices.pdf
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PDF
Altius execution marketplace concept.pdf
PDF
Ensemble model-based arrhythmia classification with local interpretable model...
PDF
Co-training pseudo-labeling for text classification with support vector machi...
PDF
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
PDF
Examining Bias in AI Generated News Content.pdf
PDF
substrate PowerPoint Presentation basic one
PDF
Electrocardiogram sequences data analytics and classification using unsupervi...
PDF
Data Virtualization in Action: Scaling APIs and Apps with FME
PDF
Aug23rd - Mulesoft Community Workshop - Hyd, India.pdf
PPTX
Internet of Everything -Basic concepts details
PDF
Build Real-Time ML Apps with Python, Feast & NoSQL
PDF
Lung cancer patients survival prediction using outlier detection and optimize...
PDF
CEH Module 2 Footprinting CEH V13, concepts
PDF
Introduction to MCP and A2A Protocols: Enabling Agent Communication
PDF
“The Future of Visual AI: Efficient Multimodal Intelligence,” a Keynote Prese...
PPTX
SGT Report The Beast Plan and Cyberphysical Systems of Control
PDF
ment.tech-Siri Delay Opens AI Startup Opportunity in 2025.pdf
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
zbrain.ai-Scope Key Metrics Configuration and Best Practices.pdf
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
Altius execution marketplace concept.pdf
Ensemble model-based arrhythmia classification with local interpretable model...
Co-training pseudo-labeling for text classification with support vector machi...
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
Examining Bias in AI Generated News Content.pdf
substrate PowerPoint Presentation basic one
Electrocardiogram sequences data analytics and classification using unsupervi...
Data Virtualization in Action: Scaling APIs and Apps with FME
Aug23rd - Mulesoft Community Workshop - Hyd, India.pdf
Internet of Everything -Basic concepts details
Build Real-Time ML Apps with Python, Feast & NoSQL
Lung cancer patients survival prediction using outlier detection and optimize...
CEH Module 2 Footprinting CEH V13, concepts
Introduction to MCP and A2A Protocols: Enabling Agent Communication
“The Future of Visual AI: Efficient Multimodal Intelligence,” a Keynote Prese...
SGT Report The Beast Plan and Cyberphysical Systems of Control
ment.tech-Siri Delay Opens AI Startup Opportunity in 2025.pdf

Using Docker in CI process

  • 1. Introduction The pipeline The environment The images The problems Finish Using Docker in CI process Applied Docker G. Godlewski March 16, 2016
  • 2. Introduction The pipeline The environment The images The problems Finish Author About me Programming, karate, music and cheese making. Currently working for SMT Software Services
  • 3. Introduction The pipeline The environment The images The problems Finish The background Long time ago, in a galaxy far, far away...
  • 4. Introduction The pipeline The environment The images The problems Finish The background
  • 5. Introduction The pipeline The environment The images The problems Finish The background Scope of automation Unit tests Functional tests Integration tests Quality checks (nightly build, code coverage, phpmd, phpcs, jshint, jslint, ...) Deployments One should constantly search for spots where time could be saved
  • 6. Introduction The pipeline The environment The images The problems Finish Definitions Continuous Integration Martin Fowler: Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible.
  • 7. Introduction The pipeline The environment The images The problems Finish Definitions Continuous Delivery Martin Fowler: A common question we hear is “what is the difference between Continuous Delivery and Continuous Deployment?” Both terms are similar and were coined around the same time. I see the difference as a business decision about frequency of deployment into production. Continuous Delivery is about keeping your application in a state where it is always able to deploy into production. Continuous Deployment is actually deploying every change into production, every day or more frequently.
  • 8. Introduction The pipeline The environment The images The problems Finish Product The point of view
  • 9. Introduction The pipeline The environment The images The problems Finish Process The process Building - parts put together, diagnostics and verification, removal of unnecessary parts Packaging - a ready product is being put into a package (container) Delivery - the whole package is shipped to the client in a clearly defined manner Each of the stages has a clear I/O definition
  • 10. Introduction The pipeline The environment The images The problems Finish Process Building up a complete solution In case of a product composed from several components (eg. complex system) we could use the analogy of buying kitchen furniture. All packages contain components that fulfill a defined set of criteria We know how the components should be connected We know how the components should be placed within client’s infrastructure (kitchen) Don’t dismiss the power of analogy!
  • 11. Introduction The pipeline The environment The images The problems Finish Warming up! What will we use Docker for Performing CI builds within isolated containers (docker in docker, sic!) Providing the package for the product in which will it be further distributed Running our applications
  • 12. Introduction The pipeline The environment The images The problems Finish Warming up!
  • 13. Introduction The pipeline The environment The images The problems Finish Warming up! Getting ready 1 Ensure the right kernel version (starting from 3.10!) 2 Ensure you have all required kernel modules (aufs, devicemapper etc - depends on the distribution) 3 Latest docker-engine installed 4 Latest docker-compose installed
  • 14. Introduction The pipeline The environment The images The problems Finish Additional tools Ansible What for? Describe how the application should be delivered (deployment to server) Configuration management Why? Great documentation Huge amount of modules - I didn’t have to build my own yet!
  • 15. Introduction The pipeline The environment The images The problems Finish Own Docker Hub Docker Hub hub: restart: always image: registry:2 ports: - "5000:5000" environment: TERM: linux REGISTRY_HTTP_TLS_CERTIFICATE: :) REGISTRY_HTTP_TLS_KEY: :) REGISTRY_AUTH: htpasswd REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm volumes: - "/home/docker-distro/registry/data:/var/lib/registry" - "/etc/ssl/certs:/certs" - "/etc/ssl/private:/keys" - "/home/docker-distro/registry/auth:/auth" Hint Keep security in mind!
  • 16. Introduction The pipeline The environment The images The problems Finish The CI Server TeamCity Free version provides: 3 build agents 20 build configurations Broad configuration capabilities (build parameters, configuration templates, defining dependencies etc)
  • 17. Introduction The pipeline The environment The images The problems Finish Understanding CI Build Server and Build Agents
  • 18. Introduction The pipeline The environment The images The problems Finish Customs Special forces
  • 19. Introduction The pipeline The environment The images The problems Finish Customs Custom Agent FROM sjoerdmulder/teamcity-agent:latest MAINTAINER Grzegorz Godlewski <[email protected]> RUN apt-get -y install software-properties-common RUN apt-add-repository ppa:ansible/ansible RUN apt-get update RUN apt-get -y install ansible COPY ./keys/id_rsa /home/teamcity/.ssh/id_rsa RUN chown -R teamcity:teamcity /home/teamcity/.ssh ADD docker-entrypoint.sh /docker-entrypoint.sh RUN chmod a+x docker-entrypoint.sh
  • 20. Introduction The pipeline The environment The images The problems Finish Customs Extending the images
  • 21. Introduction The pipeline The environment The images The problems Finish Implementation TeamCity Server server: image: "sjoerdmulder/teamcity:latest" ports: - "8111:8111" volumes: - "/home/teamcity/server/data:/var/lib/teamcity" environment: TERM: linux
  • 22. Introduction The pipeline The environment The images The problems Finish Implementation TeamCity Agent agent: image: "my-own-hub/teamcity-agent:latest" ports: - "9090:9090" volumes: - "/var/run/docker.sock:/var/run/docker.sock" # docker in docker - "/usr/bin/docker:/usr/bin/docker" - "/usr/bin/docker:/usr/local/bin/docker" - "/home/teamcity/agent/work:/opt/buildAgent/work" # work directories - "/home/teamcity/agent/composer:/opt/composer/cache" # composer cache - "/home/teamcity/agent/docker:/home/teamcity/.docker" # hub auth keys environment: TERM: linux TEAMCITY_SERVER: "http://teamcity_server:8111" # your server TEAMCITY_AGENT_NAME: "Alpha" # readable name AGENT_HOME_ON_HOST: "/home/teamcity/agent" # custom ENV for runtime
  • 23. Introduction The pipeline The environment The images The problems Finish Implementation The flow 1 Run build in dev image 2 Package using dist image 3 Distribute using Ansible and docker-compose
  • 24. Introduction The pipeline The environment The images The problems Finish It’s never that easy Not so easy... Cleaning up CI process performance Proper kernel modules Dynamically linked modules Race conditions
  • 25. Introduction The pipeline The environment The images The problems Finish It’s never that easy https://github.com/docker/docker/issues/4036
  • 26. Introduction The pipeline The environment The images The problems Finish It’s never that easy https://github.com/docker/docker/issues/4036 If you’re using the devicemapper diver, make sure that Udev Sync Supported is set to true.
  • 27. Introduction The pipeline The environment The images The problems Finish Questions?
  • 28. Introduction The pipeline The environment The images The problems Finish Thank you! http://linkedin.com/in/ggodlewski [email protected] @GGodlewski