Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introduction to Docker
Search
Michael Sauter
March 13, 2014
Technology
0
96
Introduction to Docker
A short introduction to Docker at the Web Dev Melbourne meetup
Michael Sauter
March 13, 2014
Tweet
Share
More Decks by Michael Sauter
See All by Michael Sauter
Don't Aim for Reusability
michaelsauter
2
370
Ruby Development Environment with Docker
michaelsauter
0
61
Other Decks in Technology
See All in Technology
コードファーストの考え方。 Amplify Gen2から学ぶAWS次世代のWeb開発体験
yoshiitaka
2
370
Building Dashboards as a Hobby
egmc
0
370
生成AIの変革の時代に、直近1年で直面した課題とその解決策
ktc_wada
0
660
よく聞くけど使ったことないソフトウェアNo.1 KafkaとSnowflake
foursue
4
510
ゼロから始めるVue.jsコミュニティ貢献 / first-vuejs-community-contribution-link-and-motivation
lmi
1
150
Cloud Service Mesh に触れ合う
phaya72
1
230
開発パフォーマンスを最大化するための開発体制
ham0215
7
1.1k
コードや知識を組み込む / Incorporate Code and knowledge
ks91
PRO
0
150
Android Target SDK 35 (Android 15) 対応の概要
akkie76
0
160
require(ESM)とECMAScript仕様
uhyo
4
980
いいたいことちゃんという
tkengo
0
230
ワールドカフェI /チューターを改良する / World Café I and Improving the Tutors
ks91
PRO
0
150
Featured
See All Featured
Code Review Best Practice
trishagee
56
15k
Pencils Down: Stop Designing & Start Developing
hursman
117
11k
Designing for humans not robots
tammielis
247
25k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
8
1.3k
Building Applications with DynamoDB
mza
88
5.6k
Teambox: Starting and Learning
jrom
128
8.4k
Automating Front-end Workflow
addyosmani
1357
200k
Bootstrapping a Software Product
garrettdimon
PRO
302
110k
A Philosophy of Restraint
colly
197
16k
Building a Scalable Design System with Sketch
lauravandoore
457
32k
A Tale of Four Properties
chriscoyier
152
22k
The World Runs on Bad Software
bkeepers
PRO
61
6.7k
Transcript
Introduction to Docker by @michaelsauter
How do you develop for the web? Directly on your
OS? Inside a VM? There is another way ... Docker!
What is Docker? Based on Linux containers virtualization method for
running isolated Linux systems on a host Open-source tool to make it easy and accessible
It's like a ... Lightweight VM Isolated process just like
a VM, only smaller and faster run one process inside a container
What forms a Docker container?
Why Docker? Build once ... run anywhere isolated from host
(e.g. build locally, run remotely) Isolation between containers avoid dependency hell Automation & Abstraction build, start, stop, attach, remove etc. Reusable services (via Docker Index) MySQL, PostgreSQL, Redis, ... images playgrounds for frameworks?
Alright, alright, here's the demo ... ... a Sinatra blog!
Ruby Based on d11wtq/ruby , running bundle exec rackup Linked to ... PostgreSQL Using orchardup/postgresql , running postgres
PostgreSQL container # Create and start container docker run \
--env POSTGRESQL_DB=sinatra --env POSTGRESQL_USER=sinatra --env POSTGRESQL_PASS=sinatra \ --publish 5432:5432 \ --detach --name sinatra_db orchardup/postgresql
Sinatra container # Dockerfile (describes build steps) FROM d11wtq/ruby RUN
sudo apt-get install -y -q libpq-dev WORKDIR /data CMD bundle install --path vendor && bundle exec rake db:migrate && bundle exec rackup # Build image docker build -t michaelsauter/sinatra-example . # Create and start container docker run \ --env POSTGRESQL_DB=sinatra --env POSTGRESQL_USER=sinatra --env POSTGRESQL_PASS=sinatra \ --link sinatra_db:db \ --publish 9292:9292 \ --volume /Code/web-dev-meetup/app:/data \ --detach --name sinatra_app michaelsauter/sinatra-example # In app.rb db = URI.parse(ENV["DB_PORT"]) # Set by Docker, e.g. tcp://172.17.0.2:5432 ActiveRecord::Base.establish_connection( adapter: "postgresql", host: db.host, port: db.port, username: ENV["POSTGRESQL_USER"], password: ENV["POSTGRESQL_PASS"], database: ENV["POSTGRESQL_DB"], encoding: "utf8" )
Demo, for real Ok, I'll cheat: I have already downloaded
/ built the images, and I'm using a small tool, , which will save me the typing. Crane
Thank you! Questions? Sinatra environment available at github.com/michaelsauter/sinatra-crane-env BTW, this
presentation runs in Docker, too :) It's using a container running NodeJS to provide Markdown + speaker notes support for reveal.js