SlideShare a Scribd company logo
1 of 18
Containers #101
Building a micro-service using
Node.js & Docker
July 15
Recording available at:
https://vimeo.com/133709066
About the meetup
• A series of 30 min webinars + 10 min Q&A
• Hands On
• Session are recorded
• Suggested topics and presenters are
welcome
About me
• Developer, entrepreneur and technology
enthusiast
• Live in the Silicon Valley since 2008
• Founder and CEO of Codefresh
• Member of the Node.js foundation
@RazielTabib
About codefresh
• A Docker platform for development teams.
• Build, Run & Test Docker containers
• Launch any PR, Commit or Branch in
seconds
@codefresh
What we will see today
• Create a base Docker image
ubuntu
Node.js
base image
What we will see today
• Create a base Docker image
• Build a simple micro-service
ubuntu
Node.js
base image
micro-service
What we will see today
• Create a base Docker image
• Build a simple micro-service
• Run our micro-service inside a container
ubuntu
Node.js
base image
micro-service
What we will see today
• Create a base Docker image
• Build a simple micro-service
• Run our micro-service inside a container
• Create a Docker image from an existing container
ubuntu
Node.js
base image
micro-service
micro-service image
What we will see today
• Create a base Docker image
• Build a simple micro-service
• Run our micro-service inside a container
• Create a Docker image from an existing container
• Publish our image in Docker hub
ubuntu
Node.js
base image
micro-service
micro-service image
Terminology
Docker Images
Blueprints of our application
Docker Container
Created from docker images and are real instances of our application
Docker Daemon
Building, running and distributing Docker containers
Docker Client
Run on our local machine and connect to the daemon
Docker Hub
A registry of docker images
https://www.airpair.com/node.js/posts/getting-started-with-docker-for-the-nodejs-dev
Create a base image
• Check boot2docker version & status
11
Raziels-Air:~ RazielMac$ boot2docker version
• search, pull & run ubuntu image
Raziels-Air:~ RazielMac$ boot2docker status
Raziels-Air:~ RazielMac$ docker search ubuntu
Raziels-Air:~ RazielMac$ docker run -it ubuntu ./bin/bash
• Install node
Raziels-Air:~ apt-get update
Raziels-Air:~ apt-get install nodejs
Raziels-Air:~ apt-get install nodejs-legacy
ubuntu
Node.js
base image
Raziels-Air:~ apt-get install npm
• Create a Docker image
Raziels-Air:~ docker commit –a “razielt” CONTAINER-ID IMAGE-NAME:tag
Build a simple micro-service
• Create a skeleton using express generator
12
Raziels-Air:~ RazielMac$ npm install –g express-generator
• Add an api.js with simple get function
Raziels-Air:~ RazielMac$ express microservice
• Run micro-service locally
Raziels-Air:~ npm install
Raziels-Air:~ npm start
/* GET greeting. */
router.get('/sayhello', function(req, res) {
res.send('Hello meetup members');
});
micro-service
Run inside a container
• Get our local directory path
13
Raziels-Air:~ pwd
• Run a container with volume mounting and port mapping
• Copy micro-service to container
Raziels-Air:~ cp –r host /microservice
Raziels-Air:~ cd microservice
ubuntu
Node.js
micro-service
base image
Raziels-Air:~ RazielMac$ docker run –it –v HOSTFOLDER:CONTAINERFOLDER –p HOSTPORT:CONTAINERPORT
IMAGENAME:TAG
Raziels-Air:~ npm start
Create & run docker image
• Create an image
14
Raziels-Air:~ docker commit CONTAINERID, IMAGENAME:TAG
• Run micro-service in the background
ubuntu
Node.js
micro-service
base image
Raziels-Air:~ RazielMac$ docker run –d –w /microservice –p 9000:3000 IMAGENAME npm start
micro-service image
Push to Docker hub
• Login
15
Raziels-Air:~ docker login
• Push out image
ubuntu
Node.js
micro-service
base image
Raziels-Air:~ RazielMac$ docker tag nodejs-microservice your_dockerhub_user/nodejs-microservice
micro-service image
Raziels-Air:~ RazielMac$ docker push your_dockerhub_user/nodejs-microservice
What we did today
• Create base Docker image
• Build a simple micro-service
• Run our micro-service inside a container
• Create a Docker image from an existing container
• Publish our image in Docker hub
ubuntu
Node.js
base image
micro-service
micro-service image
additional resources
• Codefresh blog blog.codefresh.io
• Containers #101 meetup
http://www.meetup.com/Containers-101-online-meetup/
• Docker Online meetup (delivered by Docker)
http://www.meetup.com/Docker-Online-Meetup/
@codefresh
Questions?
raziel@codefresh.io
www.codefresh.io
@RazielTabib
Sign up to our beta @ www.codefresh.io
Recording available at:
https://vimeo.com/133709066

More Related Content

Recently uploaded

(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 

Recently uploaded (20)

(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 

Featured

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 

Featured (20)

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

Building a micro-service using Node.js and Docker - Part #1

  • 1. Containers #101 Building a micro-service using Node.js & Docker July 15 Recording available at: https://vimeo.com/133709066
  • 2. About the meetup • A series of 30 min webinars + 10 min Q&A • Hands On • Session are recorded • Suggested topics and presenters are welcome
  • 3. About me • Developer, entrepreneur and technology enthusiast • Live in the Silicon Valley since 2008 • Founder and CEO of Codefresh • Member of the Node.js foundation @RazielTabib
  • 4. About codefresh • A Docker platform for development teams. • Build, Run & Test Docker containers • Launch any PR, Commit or Branch in seconds @codefresh
  • 5. What we will see today • Create a base Docker image ubuntu Node.js base image
  • 6. What we will see today • Create a base Docker image • Build a simple micro-service ubuntu Node.js base image micro-service
  • 7. What we will see today • Create a base Docker image • Build a simple micro-service • Run our micro-service inside a container ubuntu Node.js base image micro-service
  • 8. What we will see today • Create a base Docker image • Build a simple micro-service • Run our micro-service inside a container • Create a Docker image from an existing container ubuntu Node.js base image micro-service micro-service image
  • 9. What we will see today • Create a base Docker image • Build a simple micro-service • Run our micro-service inside a container • Create a Docker image from an existing container • Publish our image in Docker hub ubuntu Node.js base image micro-service micro-service image
  • 10. Terminology Docker Images Blueprints of our application Docker Container Created from docker images and are real instances of our application Docker Daemon Building, running and distributing Docker containers Docker Client Run on our local machine and connect to the daemon Docker Hub A registry of docker images https://www.airpair.com/node.js/posts/getting-started-with-docker-for-the-nodejs-dev
  • 11. Create a base image • Check boot2docker version & status 11 Raziels-Air:~ RazielMac$ boot2docker version • search, pull & run ubuntu image Raziels-Air:~ RazielMac$ boot2docker status Raziels-Air:~ RazielMac$ docker search ubuntu Raziels-Air:~ RazielMac$ docker run -it ubuntu ./bin/bash • Install node Raziels-Air:~ apt-get update Raziels-Air:~ apt-get install nodejs Raziels-Air:~ apt-get install nodejs-legacy ubuntu Node.js base image Raziels-Air:~ apt-get install npm • Create a Docker image Raziels-Air:~ docker commit –a “razielt” CONTAINER-ID IMAGE-NAME:tag
  • 12. Build a simple micro-service • Create a skeleton using express generator 12 Raziels-Air:~ RazielMac$ npm install –g express-generator • Add an api.js with simple get function Raziels-Air:~ RazielMac$ express microservice • Run micro-service locally Raziels-Air:~ npm install Raziels-Air:~ npm start /* GET greeting. */ router.get('/sayhello', function(req, res) { res.send('Hello meetup members'); }); micro-service
  • 13. Run inside a container • Get our local directory path 13 Raziels-Air:~ pwd • Run a container with volume mounting and port mapping • Copy micro-service to container Raziels-Air:~ cp –r host /microservice Raziels-Air:~ cd microservice ubuntu Node.js micro-service base image Raziels-Air:~ RazielMac$ docker run –it –v HOSTFOLDER:CONTAINERFOLDER –p HOSTPORT:CONTAINERPORT IMAGENAME:TAG Raziels-Air:~ npm start
  • 14. Create & run docker image • Create an image 14 Raziels-Air:~ docker commit CONTAINERID, IMAGENAME:TAG • Run micro-service in the background ubuntu Node.js micro-service base image Raziels-Air:~ RazielMac$ docker run –d –w /microservice –p 9000:3000 IMAGENAME npm start micro-service image
  • 15. Push to Docker hub • Login 15 Raziels-Air:~ docker login • Push out image ubuntu Node.js micro-service base image Raziels-Air:~ RazielMac$ docker tag nodejs-microservice your_dockerhub_user/nodejs-microservice micro-service image Raziels-Air:~ RazielMac$ docker push your_dockerhub_user/nodejs-microservice
  • 16. What we did today • Create base Docker image • Build a simple micro-service • Run our micro-service inside a container • Create a Docker image from an existing container • Publish our image in Docker hub ubuntu Node.js base image micro-service micro-service image
  • 17. additional resources • Codefresh blog blog.codefresh.io • Containers #101 meetup http://www.meetup.com/Containers-101-online-meetup/ • Docker Online meetup (delivered by Docker) http://www.meetup.com/Docker-Online-Meetup/ @codefresh
  • 18. Questions? raziel@codefresh.io www.codefresh.io @RazielTabib Sign up to our beta @ www.codefresh.io Recording available at: https://vimeo.com/133709066