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
LaraconEU 2018 - Kickass Development Environmen...
Search
David McKay
August 30, 2018
Technology
2
290
LaraconEU 2018 - Kickass Development Environments with Docker
David McKay
August 30, 2018
Tweet
Share
More Decks by David McKay
See All by David McKay
The Telegraf Toolbelt (InfluxDays SF, 2019)
rawkode
0
130
The DShell Pattern (DevOpsDays London 2019)
rawkode
0
190
Cloud Native Telegraf - Cloud Native London (September 2019)
rawkode
0
46
Developing Your Own Flux Packages (InfluxDays London 2019)
rawkode
0
120
Introduction to Time Series (Software Circus, April 2019)
rawkode
0
140
Introduction to Time Series (Cloud Native Kraków, April 2019)
rawkode
0
89
Introduction to Time Series (Cloud Native Wales, April 2019)
rawkode
0
83
Introduction to InfluxDB 2.0 (Kubernetes London - February 2019)
rawkode
0
56
Kickass Development Environments with Docker (PHPBenelux 2019)
rawkode
0
100
Other Decks in Technology
See All in Technology
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
33k
「完全に理解したTalk」完全に理解した
segavvy
1
270
Storage Browser for Amazon S3
miu_crescent
1
350
30分でわかるデータ分析者のためのディメンショナルモデリング #datatechjp / 20250120
kazaneya
PRO
16
3.9k
Unsafe.BitCast のすゝめ。
nenonaninu
0
150
pg_bigmをRustで実装する(第50回PostgreSQLアンカンファレンス@オンライン 発表資料)
shinyakato_
0
150
AI×医用画像の現状と可能性_2024年版/AI×medical_imaging_in_japan_2024
tdys13
0
1.2k
アジャイルチームが変化し続けるための組織文化とマネジメント・アプローチ / Agile management that enables ever-changing teams
kakehashi
2
2.4k
Oracle Exadata Database Service(Dedicated Infrastructure):サービス概要のご紹介
oracle4engineer
PRO
0
12k
3年でバックエンドエンジニアが5倍に増えても破綻しなかったアーキテクチャ そして、これから / Software architecture that scales even with a 5x increase in backend engineers in 3 years
euglena1215
11
4.3k
いまからでも遅くないコンテナ座学
nomu
0
200
.NET AspireでAzure Functionsやクラウドリソースを統合する
tsubakimoto_s
0
140
Featured
See All Featured
For a Future-Friendly Web
brad_frost
176
9.5k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Designing for humans not robots
tammielis
250
25k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3.1k
The Pragmatic Product Professional
lauravandoore
32
6.4k
A Tale of Four Properties
chriscoyier
157
23k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.5k
VelocityConf: Rendering Performance Case Studies
addyosmani
327
24k
Scaling GitHub
holman
459
140k
Transcript
Hello, LaraconEU 2018
@rawkode @
[email protected]
Organiser of Things ◍ Cloud Native Glasgow ◍
DevOps Glasgow ◍ MongoDB Glasgow ◍ PairProg Glasgow Software & Site Reliability ◍ Elixir / Rust / Go / Pony ◍ Docker / CI / CD ◍ DevOps / SaltStack ◍ Event-Driven Systems ◍ CQRS / ES
Kickass Development Environments with Docker
Let us travel through time ...
My Development Environment Circa 2000 $ tree awesome-million-pound-project └── src
├── game.php ├── game.php.bk-david ├── game.php.bk-deano ├── main.php ├── main.php.maybe-fixed ├── main.php.bk-1999-12-02 ├── main.php.bk-1999-12-02.2 ├── player.php ├── player.php.orig └── .swp.player.php
My Development Production Environment Circa 2000 $ tree awesome-million-pound-project └──
src ├── game.php ├── game.php.bk-david ├── game.php.bk-deano ├── main.php ├── main.php.maybe-fixed ├── main.php.bk-1999-12-02 ├── main.php.bk-1999-12-02.2 ├── player.php ├── player.php.orig └── .swp.player.php
Things eventually got better ...
None
None
Dev / Prod Parity
Eurgh, DSL Hell
None
Problems with Vagrant Slow to provision RAM intensive Really, development
only Requires a CM tool
How long does your vagrant up take?
None
“ Docker allows you to package an application with all
of its dependencies into a standardized unit for software development.
Docker ◍ Image Builder ◍ Image Delivery ◍ Virtualisation ◍
Orchestration (Dev) ➢ docker image build ➢ docker image push/ll ➢ docker container run ➢ docker-compose Build. Ship. Run.
Image Building Introducing the Dockerfile
(Simplified) Dockerfile for PHP FROM ubuntu:18.04 RUN apt install -y
php-cli COPY hello.php /code WORKDIR /code ENTRYPOINT [“php”] CMD [“-v”]
(Simplified) Dockerfile for PHP FROM ubuntu:18.04 RUN apt install -y
php-cli COPY hello.php /code WORKDIR /code ENTRYPOINT [“php”] CMD [“-v”]
(Simplified) Dockerfile for PHP FROM ubuntu:18.04 RUN apt install -y
php-cli COPY hello.php /code WORKDIR /code ENTRYPOINT [“php”] CMD [“-v”]
(Simplified) Dockerfile for PHP FROM ubuntu:18.04 RUN apt install -y
php-cli COPY hello.php /code WORKDIR /code # PLEASE DON’T DO RUN cd /code
(Simplified) Dockerfile for PHP FROM ubuntu:18.04 RUN apt install -y
php-cli COPY hello.php /code WORKDIR /code ENTRYPOINT [“php”] CMD [“-v”]
None
ENTRYPOINT & CMD Explained in 20 seconds
ENTRYPOINT and CMD Explained in 17 seconds ... CMD [“echo”,
“Hello”] in a Dockerfile docker run my-image == $ Hello
ENTRYPOINT and CMD Explained in 13 seconds ... CMD [“echo”,
“Hello”] in a Dockerfile docker run my-image echo Goodbye == $ Goodbye
ENTRYPOINT and CMD Explained in 10 seconds ... ENTRYPOINT [“echo”]
CMD [“Hello”] in a Dockerfile docker run my-image == $ Hello
ENTRYPOINT and CMD Explained in 7 seconds ... ENTRYPOINT [“echo”]
CMD [“Hello”] in a Dockerfile docker run --entrypoint=”echo” my-image Woop! == $ Woop!
ENTRYPOINT and CMD Explained in 4 seconds ... ENTRYPOINT [“echo”]
CMD [“Hello”] in a Dockerfile docker run --entrypoint=”echo” my-image == $
None
Docker ◍ Image Builder ◍ Image Delivery ◍ Virtualisation ◍
Orchestration (Dev) ➔ docker image build ➔ docker image push/ll ➔ docker container run ➔ docker-compose
Image Delivery & Virtualisation Running Docker Images as Containers
Demo
Docker ◍ Image Builder ◍ Image Delivery ◍ Virtualisation ◍
Orchestration (Dev) ➔ docker build ➔ docker push / pull ➔ docker run ➔ docker-compose
Orchestration (Dev) Composing Services
Your Super Application
Your Super Application
Docker Compose
Docker for Local Development 4 Easy Steps. I’ll discuss 3.
1. Satisfy Dependencies 2. Introduce Docker for CI 3. Adopt Docker Shell Pattern 4. 12-Factor (Catch Alex’s talk on YouTube)
Satisfy Dependencies PostgreSQL, Redis, Elasticsearch, et al.
docker-compose.yml services: database: image: mariadb:10.1 environment: MYSQL_USER: rawkode MYSQL_PASSWORD: *******
MYSQL_DATABASE: my-awesome-app
docker-compose.yml version: “2.4”
docker-compose.yml version: “2.4” services: php: image: php:7 ports: - 80:80
volumes: - .:/code:cached tmpfs: - /code/var/logs - /code/var/cache
docker-compose.yml version: “2.4” services: php: image: php:7 … database: image:
mariadb:10.1 environment: MYSQL_USERNAME: rawkode MYSQL_PASSWORD: *******
docker-compose.yml version: “2.4” services: php: image: php:7 healthcheck: test: nc
-z localhost 80 depends_on: database: condition: service_healthy
Introduce Docker to CI Craft Your Dockerfile
Docker for CI ◍ Multi-Stage Builds ◍ Mind Your Build-Cache
◍ Be Wary of “Helper” Scripts ◍ We’ll cover these in the demo
Docker Shell Maintain Native Workflows
Docker Shell Pattern ◍ Your base container has all your
system dependencies (Don’t use --ignore-platform-reqs) ◍ Work natively, but in the container ◍ You’ll still get all the perks
Demo
Docker ◍ Image Builder ◍ Virtualisation ◍ Image Delivery ◍
Orchestration (Dev) ➔ docker build ➔ docker run ➔ docker push / pull ➔ docker-compose
Tips I’ve learnt the hard way, so you don’t have
to
Zsh Plugin https://github.com /rawkode /zsh-docker-run
Tips: Don’t Bust Your Build Cache COPY composer.json /code RUN
composer install COPY . /code
Tips: Mindful of Network Collisions Every new docker-compose file is,
potentially, a new docker network / bridge on your host. Eventually, you’ll get a collision docker-compose down Add -v to remove volumes
Tips: Logging ALWAYS LOG to STDOUT
Tips: Prune docker system prune Docker CE >= 17.04
Tips: Alpine Linux Unless you need Ubuntu / Fedora, use
Alpine Linux Ubuntu -- 130MB / 85MB Alpine -- 3.99MB
Production Tip nginx & fpm --volumes-from=php
Production Tip Open Census Open Metrics Open Tracing
Production Tip Mandatory Requirement --read-only
Thank You! Questions? @
[email protected]
@rawkode