An open platform for distributed applications
It's based on Linux containers
Allows you to pack an application along with its stack
Abstract application from the guest OS
Prevents dependency hell
Big companies use containers to deploy applications many time a day
Docker makes it easy for everyone to work with containers
Provides a simple workflow around containers
Docker separates applications from infrastructure using container technology
Similar to how Virtual Machines separates OS from the hardware it runs in
Run apps locally in two steps
Have a consistent environment across different machines
Docker apps can be run anywhere, on any machine
From: https://speakerdeck.com/asm89/docker
FROM ruby:2.3.1
RUN apt-get update
RUN apt-get install nodejs
RUN mkdir /myapp
WORKDIR /myapp
ADD Gemfile /myapp/Gemfile
ADD Gemfile.lock /myapp/Gemfile.lock
# FROM: Get image from docker index
# RUN: Run commands inside container
Dockerfile
db:
image: postgres:9.5.0
volumes:
- .:/tmp/data/
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- .:/code
ports:
- "3000:3000"
links:
- db
# Rails server
# Share this folder
# Get Postgres image
docker-compose.yml
# Build project
docker-compose build
Docker commands
# Run project
docker-compose up