$30 off During Our Annual Pro Sale. View Details »
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
45
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
88
Introduction to Time Series (Cloud Native Wales, April 2019)
rawkode
0
81
Introduction to InfluxDB 2.0 (Kubernetes London - February 2019)
rawkode
0
56
Kickass Development Environments with Docker (PHPBenelux 2019)
rawkode
0
96
Other Decks in Technology
See All in Technology
RDRAとLLM
kanzaki
4
480
asumikamというカンファレンスオーガナイザの凄さを語る / The Brilliance of Asumikam
tomzoh
1
160
4年で17倍に成長したエンジニア組織を支えるアーキテクチャの過去と未来
sansantech
PRO
1
4.6k
ONNX推論クレートの比較と実装奮闘記
emergent
0
250
ご挨拶
iotcomjpadmin
0
180
RAMP2024
takeyukitamura
3
220
情シスの引継ぎが大変という話
miyu_dev
2
520
GAS × Discord bot × Gemini で作ったさいきょーの情報収集ツール
ysknsid25
1
350
iOS 18 から追加された SwiftUI の傾向について調べてみる
swiftty
2
100
ゆるSRE勉強会 #8 組織的にSREが始まる中で意識したこと
abnoumaru
1
690
【Oracle Cloud ウェビナー】【入門&再入門】はじめてのOracle Cloud Infrastructure [+最新情報]
oracle4engineer
PRO
2
110
SLMをエッジAIとして検証してみて分かったこと
iotcomjpadmin
0
180
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
GitHub's CSS Performance
jonrohan
1030
460k
Ruby is Unlike a Banana
tanoku
97
11k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Code Reviewing Like a Champion
maltzj
520
39k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Documentation Writing (for coders)
carmenintech
65
4.5k
Rails Girls Zürich Keynote
gr2m
94
13k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
760
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
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