SlideShare a Scribd company logo
Node.js in a Docker Container
Lenworth Henry (lenworth.henry@gmail.com)
What is Docker
●

●

Docker is an easy way to create a lightweight
container from any application
The same container you use in development
can be scaled to production on any platform
that supports Linux Containers (Amazon, VMs,
etc)
What can you do with Docker
●

Software distribution (app + dependencies)
–

e.g. NodeJs web apps (app+node+mongo+redis)

●

Fast spin-up VMs (no booting)

●

Automated testing and continuous integration/deployment.

●

●

Deploying and scaling databases and back-end services
in a service-oriented environment.
Document what components you need to run your
application
Why did I seek out Docker
●

●

●

Every time a new framework or library was
added to our code base the developers got
out of sync and we lost productivity
We needed a way to synchronize our
development environments
I also needed a way to keep track of all the
components that we were using in our
application (i.e. not use history to tell what I
have installed)
Why not Vagrant
●

●

●

Vagrant requires each machine to have
VM software like Virtuabox
Vagrant is not designed for creating
containers for production because of
all the overhead
Vagrant wasn't any easier to configure
than docker, but, the container footprint
was larger
What  you will need
●

A workstation running Linux kernel 3.8
or greater
–

●

Docker containers can run inside VMs like
Virtuabox, but, as Linux containers they
are made for Linux

Knowledge of how to configure your
application on bare hardware
–

There is lots of help for this
Getting Started With Docker
Simple Docker Example
Docker speak
●

●

●

A container is a running instance of an
image.
You create an image starting with one of
the images found on the index and
adding any customizations either from
inside the running container or using a
Dockerfile
Dockerfile-->(build)-->Image---(run)->Container
Two work­flows with docker
●

Using commits
–
–

Connect to the shell of the base image and add whatever software,
customizations and your source (e.g. pull a git remote repository)

–

Commit to a new image

–
●

Run a base image

Run that image

Using Dockerfile
–

Create a dockerfile that includes all your configurations,
customizations and access to your source

–

This can all be pulled down from git to a different workstation

–

This is the most reliable option since your Dockerfile should be
rewritten that you can recreate the image with one command.
How to create a Docker File
●

If you don't remember all the packages
you installed then you can launch a
shell using a base image and then run
all the steps. Each step can be copied
to the docker file as a “RUN” command
Shell for Your Container
●

Once a docker image has been
created you can run it and enter the
bash shell using this command:
–

sudo docker run -t -i --rm ubuntu bash
Docker gotchas
●

You can only run one command or entrypoint for a container
–
–

●

●

You only have one cmd or entrypoint. Only one will get executed.
You must create a start script or use something like supervisord

If you change your source on the client you have to rebuild the image to see
those changes on the container.
You can't have long running processes in your Dockerfile
–

Each step is meant to execute and complete

–

Daemon like functionality should be executed when the container is running
Two containers
●

●

●

DB container is separate because it
rarely changes
The Node app resides in its own
container
Communication is enabled between
the two containers using linking
–

Linking works the same in production
environment
Example MEAN Stack app
●

MongoDB, Express, Angular and Node
–

Uses PassPortJS for authentication
Need to start multiple 
processes?
●

●

Each Dockerfile will have only one
entry point
Two options:
–

Create your own shell script that starts up
the processes and call that using a CMD
or ENTRYPOINT

–

Use supervisord
Example supervisord.conf
Helpful Docker commands 
●

logs (sudo docker logs @containerid)
–

●

Gives a print out of the tty after running

ps (sudo docker ps)
–
–

●

Shows you all running containers
Containers running in daemon mode will show
up here for as long as they are running

stop (sudo docker stop @containerid)
–

Stops a running container
Docker Tips
●

Only run in daemon mode (-d) if you have run
it without -d to see if there are any problems
with your configuration
–

●

You will not see errors printed out to stdout while
trying to load the container

Watch your disk space while creating images
and containers
–

Docker creates intermediate containers that can
quickly eat up disk space

–

Use the -rm=true when building
Questions and Helpful Links
●

●

●

●

Main Docker Site:
https://docs.docker.io/
Index Site (Prebuilt image search):
https://index.docker.io/

How to cleanup docker disk usage:
http://sosedoff.com/2013/12/17/cleanup-docker-cont

Docker Networking Details:
https://blog.codecentric.de/en/2014/01/docker-netwo

More Related Content

What's hot

Docker introduction - Part 1
Docker introduction - Part 1Docker introduction - Part 1
Docker introduction - Part 1
Alessandro Mignogna
 
Meetup 05 27-2015
Meetup   05 27-2015Meetup   05 27-2015
Meetup 05 27-2015
Ranjan Parthasarathy
 
Docker Compose: Docker Configuration for the Real World
Docker Compose:  Docker Configuration for the Real WorldDocker Compose:  Docker Configuration for the Real World
Docker Compose: Docker Configuration for the Real World
Will Hall
 
Introduction to Docker - Getting Started with Docker
Introduction to Docker - Getting Started with DockerIntroduction to Docker - Getting Started with Docker
Introduction to Docker - Getting Started with Docker
Aiyana Shukla
 
Docker. Micro services for lazy developers
Docker. Micro services for lazy developersDocker. Micro services for lazy developers
Docker. Micro services for lazy developers
Eugene Krevenets
 
Sep Nasiri "Upwork PHP Architecture"
Sep Nasiri "Upwork PHP Architecture"Sep Nasiri "Upwork PHP Architecture"
Sep Nasiri "Upwork PHP Architecture"
Fwdays
 
Building CLI Applications with Golang
Building CLI Applications with GolangBuilding CLI Applications with Golang
Building CLI Applications with Golang
Anshul Patel
 
Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4
Binary Studio
 
Introduction to Docker Container
Introduction to Docker ContainerIntroduction to Docker Container
Introduction to Docker Container
Samsul Ma'arif
 
Boston Code Dojo - Docker meetup slides
Boston Code Dojo - Docker meetup slidesBoston Code Dojo - Docker meetup slides
Boston Code Dojo - Docker meetup slides
Calvin Froedge
 
docker compose
docker composedocker compose
docker compose
Alex Fernandez
 
Moving to Docker... Finally!
Moving to Docker... Finally!Moving to Docker... Finally!
Moving to Docker... Finally!
Squareboat
 
Docker 101
Docker 101Docker 101
Docker 101
Hung-Che Lo
 
Rkt Container Engine
Rkt Container EngineRkt Container Engine
Rkt Container Engine
Thuc Le Dong
 
Docker for developers
Docker for developersDocker for developers
Docker for developers
Anvay Patil
 
Docker cheat-sheet
Docker cheat-sheetDocker cheat-sheet
Docker cheat-sheet
Peđa Delić
 
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2
Binary Studio
 
Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1
Binary Studio
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
Marcelo Cenerino
 
Orchestration of docker containers at scale
Orchestration of docker containers at scaleOrchestration of docker containers at scale
Orchestration of docker containers at scale
Yeshwanth Kumar
 

What's hot (20)

Docker introduction - Part 1
Docker introduction - Part 1Docker introduction - Part 1
Docker introduction - Part 1
 
Meetup 05 27-2015
Meetup   05 27-2015Meetup   05 27-2015
Meetup 05 27-2015
 
Docker Compose: Docker Configuration for the Real World
Docker Compose:  Docker Configuration for the Real WorldDocker Compose:  Docker Configuration for the Real World
Docker Compose: Docker Configuration for the Real World
 
Introduction to Docker - Getting Started with Docker
Introduction to Docker - Getting Started with DockerIntroduction to Docker - Getting Started with Docker
Introduction to Docker - Getting Started with Docker
 
Docker. Micro services for lazy developers
Docker. Micro services for lazy developersDocker. Micro services for lazy developers
Docker. Micro services for lazy developers
 
Sep Nasiri "Upwork PHP Architecture"
Sep Nasiri "Upwork PHP Architecture"Sep Nasiri "Upwork PHP Architecture"
Sep Nasiri "Upwork PHP Architecture"
 
Building CLI Applications with Golang
Building CLI Applications with GolangBuilding CLI Applications with Golang
Building CLI Applications with Golang
 
Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4
 
Introduction to Docker Container
Introduction to Docker ContainerIntroduction to Docker Container
Introduction to Docker Container
 
Boston Code Dojo - Docker meetup slides
Boston Code Dojo - Docker meetup slidesBoston Code Dojo - Docker meetup slides
Boston Code Dojo - Docker meetup slides
 
docker compose
docker composedocker compose
docker compose
 
Moving to Docker... Finally!
Moving to Docker... Finally!Moving to Docker... Finally!
Moving to Docker... Finally!
 
Docker 101
Docker 101Docker 101
Docker 101
 
Rkt Container Engine
Rkt Container EngineRkt Container Engine
Rkt Container Engine
 
Docker for developers
Docker for developersDocker for developers
Docker for developers
 
Docker cheat-sheet
Docker cheat-sheetDocker cheat-sheet
Docker cheat-sheet
 
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2
 
Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Orchestration of docker containers at scale
Orchestration of docker containers at scaleOrchestration of docker containers at scale
Orchestration of docker containers at scale
 

Similar to Introduction to Docker for NodeJs developers at Node DC 2/26/2014

[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101
Naukri.com
 
Dockerized maven
Dockerized mavenDockerized maven
Dockerized maven
Matthias Bertschy
 
Docker primer and tips
Docker primer and tipsDocker primer and tips
Docker primer and tips
Samuel Chow
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday development
Justyna Ilczuk
 
Using Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsUsing Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and Jenkins
Micael Gallego
 
Docker workshop GDSC_CSSC
Docker workshop GDSC_CSSCDocker workshop GDSC_CSSC
Docker workshop GDSC_CSSC
GDSC UofT Mississauga
 
Run automated tests in Docker
Run automated tests in DockerRun automated tests in Docker
Run automated tests in Docker
Oleksandr Metelytsia
 
Docker up and Running For Web Developers
Docker up and Running For Web DevelopersDocker up and Running For Web Developers
Docker up and Running For Web Developers
BADR
 
Docker Up and Running for Web Developers
Docker Up and Running for Web DevelopersDocker Up and Running for Web Developers
Docker Up and Running for Web Developers
Amr Fawzy
 
Introduction to Docker and Monitoring with InfluxData
Introduction to Docker and Monitoring with InfluxDataIntroduction to Docker and Monitoring with InfluxData
Introduction to Docker and Monitoring with InfluxData
InfluxData
 
Lecture eight to be introduced in class.
Lecture eight to be introduced in class.Lecture eight to be introduced in class.
Lecture eight to be introduced in class.
nigamsajal14
 
docker.pdf
docker.pdfdocker.pdf
docker.pdf
EishaTirRaazia1
 
JOSA TechTalks - Docker in Production
JOSA TechTalks - Docker in ProductionJOSA TechTalks - Docker in Production
JOSA TechTalks - Docker in Production
Jordan Open Source Association
 
Docker for .NET Developers
Docker for .NET DevelopersDocker for .NET Developers
Docker for .NET Developers
Taswar Bhatti
 
Introduction of Docker and Docker Compose
Introduction of Docker and Docker ComposeIntroduction of Docker and Docker Compose
Introduction of Docker and Docker Compose
Dr. Ketan Parmar
 
Docker for developers
Docker for developersDocker for developers
Docker for developers
DrupalDay
 
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and JenkinsExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ElasTest Project
 
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
Puppet
 
Настройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'aНастройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'a
corehard_by
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
IgnacioTamayo2
 

Similar to Introduction to Docker for NodeJs developers at Node DC 2/26/2014 (20)

[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101
 
Dockerized maven
Dockerized mavenDockerized maven
Dockerized maven
 
Docker primer and tips
Docker primer and tipsDocker primer and tips
Docker primer and tips
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday development
 
Using Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsUsing Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and Jenkins
 
Docker workshop GDSC_CSSC
Docker workshop GDSC_CSSCDocker workshop GDSC_CSSC
Docker workshop GDSC_CSSC
 
Run automated tests in Docker
Run automated tests in DockerRun automated tests in Docker
Run automated tests in Docker
 
Docker up and Running For Web Developers
Docker up and Running For Web DevelopersDocker up and Running For Web Developers
Docker up and Running For Web Developers
 
Docker Up and Running for Web Developers
Docker Up and Running for Web DevelopersDocker Up and Running for Web Developers
Docker Up and Running for Web Developers
 
Introduction to Docker and Monitoring with InfluxData
Introduction to Docker and Monitoring with InfluxDataIntroduction to Docker and Monitoring with InfluxData
Introduction to Docker and Monitoring with InfluxData
 
Lecture eight to be introduced in class.
Lecture eight to be introduced in class.Lecture eight to be introduced in class.
Lecture eight to be introduced in class.
 
docker.pdf
docker.pdfdocker.pdf
docker.pdf
 
JOSA TechTalks - Docker in Production
JOSA TechTalks - Docker in ProductionJOSA TechTalks - Docker in Production
JOSA TechTalks - Docker in Production
 
Docker for .NET Developers
Docker for .NET DevelopersDocker for .NET Developers
Docker for .NET Developers
 
Introduction of Docker and Docker Compose
Introduction of Docker and Docker ComposeIntroduction of Docker and Docker Compose
Introduction of Docker and Docker Compose
 
Docker for developers
Docker for developersDocker for developers
Docker for developers
 
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and JenkinsExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
 
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
 
Настройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'aНастройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'a
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
 

Recently uploaded

Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
saastr
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Neo4j
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 

Recently uploaded (20)

Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 

Introduction to Docker for NodeJs developers at Node DC 2/26/2014

  • 1. Node.js in a Docker Container Lenworth Henry (lenworth.henry@gmail.com)
  • 2. What is Docker ● ● Docker is an easy way to create a lightweight container from any application The same container you use in development can be scaled to production on any platform that supports Linux Containers (Amazon, VMs, etc)
  • 3. What can you do with Docker ● Software distribution (app + dependencies) – e.g. NodeJs web apps (app+node+mongo+redis) ● Fast spin-up VMs (no booting) ● Automated testing and continuous integration/deployment. ● ● Deploying and scaling databases and back-end services in a service-oriented environment. Document what components you need to run your application
  • 4. Why did I seek out Docker ● ● ● Every time a new framework or library was added to our code base the developers got out of sync and we lost productivity We needed a way to synchronize our development environments I also needed a way to keep track of all the components that we were using in our application (i.e. not use history to tell what I have installed)
  • 5. Why not Vagrant ● ● ● Vagrant requires each machine to have VM software like Virtuabox Vagrant is not designed for creating containers for production because of all the overhead Vagrant wasn't any easier to configure than docker, but, the container footprint was larger
  • 6. What  you will need ● A workstation running Linux kernel 3.8 or greater – ● Docker containers can run inside VMs like Virtuabox, but, as Linux containers they are made for Linux Knowledge of how to configure your application on bare hardware – There is lots of help for this
  • 9. Docker speak ● ● ● A container is a running instance of an image. You create an image starting with one of the images found on the index and adding any customizations either from inside the running container or using a Dockerfile Dockerfile-->(build)-->Image---(run)->Container
  • 10. Two work­flows with docker ● Using commits – – Connect to the shell of the base image and add whatever software, customizations and your source (e.g. pull a git remote repository) – Commit to a new image – ● Run a base image Run that image Using Dockerfile – Create a dockerfile that includes all your configurations, customizations and access to your source – This can all be pulled down from git to a different workstation – This is the most reliable option since your Dockerfile should be rewritten that you can recreate the image with one command.
  • 11. How to create a Docker File ● If you don't remember all the packages you installed then you can launch a shell using a base image and then run all the steps. Each step can be copied to the docker file as a “RUN” command
  • 12. Shell for Your Container ● Once a docker image has been created you can run it and enter the bash shell using this command: – sudo docker run -t -i --rm ubuntu bash
  • 13. Docker gotchas ● You can only run one command or entrypoint for a container – – ● ● You only have one cmd or entrypoint. Only one will get executed. You must create a start script or use something like supervisord If you change your source on the client you have to rebuild the image to see those changes on the container. You can't have long running processes in your Dockerfile – Each step is meant to execute and complete – Daemon like functionality should be executed when the container is running
  • 14. Two containers ● ● ● DB container is separate because it rarely changes The Node app resides in its own container Communication is enabled between the two containers using linking – Linking works the same in production environment
  • 15. Example MEAN Stack app ● MongoDB, Express, Angular and Node – Uses PassPortJS for authentication
  • 16. Need to start multiple  processes? ● ● Each Dockerfile will have only one entry point Two options: – Create your own shell script that starts up the processes and call that using a CMD or ENTRYPOINT – Use supervisord
  • 18. Helpful Docker commands  ● logs (sudo docker logs @containerid) – ● Gives a print out of the tty after running ps (sudo docker ps) – – ● Shows you all running containers Containers running in daemon mode will show up here for as long as they are running stop (sudo docker stop @containerid) – Stops a running container
  • 19. Docker Tips ● Only run in daemon mode (-d) if you have run it without -d to see if there are any problems with your configuration – ● You will not see errors printed out to stdout while trying to load the container Watch your disk space while creating images and containers – Docker creates intermediate containers that can quickly eat up disk space – Use the -rm=true when building
  • 20. Questions and Helpful Links ● ● ● ● Main Docker Site: https://docs.docker.io/ Index Site (Prebuilt image search): https://index.docker.io/ How to cleanup docker disk usage: http://sosedoff.com/2013/12/17/cleanup-docker-cont Docker Networking Details: https://blog.codecentric.de/en/2014/01/docker-netwo