containers #101 : docker onbuild triggers and introduction to docker compose

15
Containers #101 Building, running & deploying Docker containers Oct 2015 Recording available at: https://vimeo.com/ 141966112

Upload: raziel-tabib-join-our-team

Post on 15-Apr-2017

2.986 views

Category:

Software


3 download

TRANSCRIPT

Page 1: Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose

Containers #101Building, running & deploying Docker containers Oct 2015

Recording available at:https://vimeo.com/141966112

Page 2: Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose

About the meetup • A series of 30 min webinars + 10 min

Q&A• Hands On• Session are recorded• Suggested topics and presenters are

welcome

Recording available athttps://vimeo.com/channels/containers101

Page 3: Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose

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

Page 4: Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose

About codefresh• A Docker platform for

development teams.• Build, Run & Test Docker

containers• New Innovator sponsor of

DockerCon Europe• We are hiring! email us to

[email protected]@codefresh

Page 5: Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose

TerminologyDocker FileA recipe for Docker image Docker ImagesBlueprints of our applicationDocker ContainerCreated from docker images and are real instances of our applicationDocker DaemonBuilding, running and distributing Docker containersDocker ClientRun on our local machine and connect to the daemonDocker HubA registry of docker images

https://www.airpair.com/node.js/posts/getting-started-with-docker-for-the-nodejs-dev

Page 6: Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose

Previous meetups

• Meetup #2: docker file, docker cache• Meetup #1: docker search, run & commit, docker hub

Recording available athttps://vimeo.com/channels/containers101

Page 7: Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose

What we will see today

• Build a simple micro-service• Create base Docker image using Docker file w ONBUILD

• Create new image with our micro-service

FROM base-image

….

Dockerfile

micro-service

micro-service

• Intro to docker compose

ubuntu

Node.js

ONBUILD

Base image

Page 8: Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose

Docker file ONBUILD command The ONBUILD instruction adds to the image a trigger instruction to be executed at a later time, when the image is used as the base for another build. The trigger will be executed in the context of the downstream build, as if it had been inserted immediately after the FROM instruction in the downstream Dockerfile.

https://docs.docker.com/reference/builder/#onbuild

Page 9: Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose

FROM base-image

Dockerfile

micro-service

FROM ubuntu:latestMAINTAINER [email protected]

ONBUILD COPY ./package.json src/ONBUILD RUN npm installONBUILD COPY . src/……..

Dockerfile

Docker file ONBUILD command

ubuntu

Node.js

ONBUILD

base-image

COPY ./package.json src/RUN npm installCOPY . src/

Page 10: Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose

Demo

Page 11: Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose

Web: build: . ports: - “9000:9000” links: - mongo

mongo: image: mongo:latest ports: - “27017:27017”

docker-compose.yml

Docker compose

Web (nodejs) Mongo

https://github.com/Codefresh-Examples/express-angular-mongo

Page 12: Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose

Web: build: . ports: - “9000:9000” links: - mongo

mongo: image: mongo:latest ports: - “27017:27017”

docker-compose.yml

Docker compose

Web (nodejs) Mongo

https://github.com/Codefresh-Examples/express-angular-mongo

Page 13: Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose

What we saw today

• Build a simple micro-service

ubuntu

Node.js

ONBUILD

micro-service image

• Create base Docker image using Docker file w ONBUILD

• Create new image with our micro-service

FROM base-image

….

Dockerfile

micro-service

micro-service

• Intro to docker compose

Page 14: Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose

additional resources• Codefresh blog blog.codefresh.io• Containers #101 http://www.meetup.com/Containers-101-online-meetup/• Docker Online meetup (delivered by Docker) http://www.meetup.com/Docker-Online-Meetup/

@codefresh

Page 15: Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose

Questions?

[email protected]

@RazielTabib

Sign up to our beta @ www.codefresh.io

We are [email protected]