docker: the basics - including a demo with an awesome full-stack js app

Download Docker: The basics - Including a demo with an awesome full-stack JS app

If you can't read please download the document

Upload: marcelo-rodrigues

Post on 15-Apr-2017

336 views

Category:

Technology


1 download

TRANSCRIPT

Docker: The basics

Marcelo CostaCloud Integration Engineer, Connections Cloud

May 2016

Including a demo with an awesome full-stack JS app

Agenda

What is Docker?

What is Jquery, MongoDB and Nashorn?

The high-level architecture of the Online Kanban Board

Docker run syntax / putting everything together

What is Docker-Compose and why it is so amazing

DEMO

Q & A

What is Docker?

What is Jquery, MongoDB and Nashorn?

Must mention: avatar.js

The high-level architecture of the Online Kanban Board

Docker run syntax / putting everything together 1/2

The basics:docker run -it busybox:latest

docker run -d busybox:latest topc646318a53cd4e16780cd654fa6df854c6550e089491f4a805ba16edd3b94c32

docker attach c646

ctrl+c stops the container (ssh if you need to jump into containers without impacting them)

Some important parameters:

ParametersConfiguration

-d (detached)Runs in detached mode (not interactive)

--nameName of the container (ID)

-h (Hostname)Hostname within Docker Network

--linkAllow communication within Docker Network

-p (Port)Exposed port (host:container)

-v (Volume)Mapped Volume/disk/path (host:container)

Name of the image (parent obj of the container)

-w (Working Dir)Initial directory/folder for container commands

Docker run syntax / putting everything together 2/2

Adding some complexity:

docker run -d --name mydbcontainer -h mykanbandbhost -p 27017:27017 -v /home/marcelo/.docker-volumes/myOnlineKanban/data:/data/db mongo

docker run -d --name mykanban -h mykanbanapp --link mydbcontainer -p 8080:8080 -w /opt/mykanban -v /home/marcelo/Projects/MyOnlineKanban/mykanban:/opt/mykanban java:8 /usr/bin/jjs -cp lib/mongo-2.10.1.jar httpsrv.js

Listing running containers:docker ps --filter status=runningCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES4c97e0fca863 busybox:latest "top" 3 seconds ago Up 2 seconds stupefied_euclid

What is Docker-Compose and why it is so amazing

Instead of executing multiple docker run commands or opening multiple terminals to start and track each container configuration, use a single command:

Docker-compose up

Docker-compose.yml

mykanban: image: java:8 working_dir: /opt/mykanban/ command: jjs -cp lib/mongo-2.10.1.jar httpsrv.js links: - mydbcontainer ports: - '8080:8080' volumes: - ~/Projects/MyOnlineKanban/mykanban:/opt/mykanban

mydbcontainer: image: mongo environment: MONGODB_USER: mongouser MONGODB_PASSWORD: meh123 hostname: mykanbandbhost ports: - '27017:27017' volumes: - ~/.docker-volumes/myOnlineKanban/data:/data/db/

DEMO

Q & A

2014 IBM Corporation

Click to edit the outline text formatSecond Outline LevelThird Outline LevelFourth Outline LevelFifth Outline Level

Sixth Outline Level

Seventh Outline Level

Eighth Outline Level

Ninth Outline Level

2014 IBM Corporation