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
Kickass Development Environments with Docker (P...
Search
David McKay
January 26, 2019
Technology
0
100
Kickass Development Environments with Docker (PHPBenelux 2019)
David McKay
January 26, 2019
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
LaraconEU 2018 - Kickass Development Environments with Docker
rawkode
2
290
Other Decks in Technology
See All in Technology
EMConf JP の楽しみ方 / How to enjoy EMConf JP
pauli
2
150
Copilotの力を実感!3ヶ月間の生成AI研修の試行錯誤&成功事例をご紹介。果たして得たものとは・・?
ktc_shiori
0
350
AWSマルチアカウント統制環境のすゝめ / 20250115 Mitsutoshi Matsuo
shift_evolve
0
120
Formal Development of Operating Systems in Rust
riru
1
420
あなたの人生も変わるかも?AWS認定2つで始まったウソみたいな話
iwamot
3
860
20250116_JAWS_Osaka
takuyay0ne
2
200
[IBM TechXchange Dojo]Watson Discoveryとwatsonx.aiでRAGを実現!事例のご紹介+座学②
siyuanzh09
0
110
Godot Engineについて調べてみた
unsoluble_sugar
0
410
.NET AspireでAzure Functionsやクラウドリソースを統合する
tsubakimoto_s
0
190
いま現場PMのあなたが、 経営と向き合うPMになるために 必要なこと、腹をくくること
hiro93n
9
7.8k
30分でわかる「リスクから学ぶKubernetesコンテナセキュリティ」/30min-k8s-container-sec
mochizuki875
3
450
メールヘッダーを見てみよう
hinono
0
110
Featured
See All Featured
Bash Introduction
62gerente
610
210k
Building Adaptive Systems
keathley
38
2.4k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
570
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
113
50k
BBQ
matthewcrist
85
9.4k
Making Projects Easy
brettharned
116
6k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
960
Building Applications with DynamoDB
mza
93
6.2k
Code Review Best Practice
trishagee
65
17k
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
3
180
A Tale of Four Properties
chriscoyier
157
23k
Transcript
Hi #phpbnl19
Kickass Development Environments with Docker
@rawkode David McKay ◍ Developer Advocate at InfluxData ◍ Docker
/ CI / CD ◍ DevOps / SaltStack ◍ Event-Driven Systems ◍ CQRS / ES ◍ Elixir, Go, and Rust
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 ◍ Virtualisation ◍ Image Delivery ◍
Orchestration (Dev) ➔ docker build ➔ docker run ➔ docker push / pull ➔ docker-compose
Image Building Introducing the Dockerfile
(Simplified) Dockerfile for PHP FROM ubuntu:17.04 RUN apt install -y
php-cli COPY hello.php /code WORKDIR /code ENTRYPOINT [“php”] CMD [“-v”]
(Simplified) Dockerfile for PHP FROM ubuntu:17.04 RUN apt install -y
php-cli COPY hello.php /code WORKDIR /code ENTRYPOINT [“php”] CMD [“-v”]
(Simplified) Dockerfile for PHP FROM ubuntu:17.04 RUN apt install -y
php-cli COPY hello.php /code WORKDIR /code ENTRYPOINT [“php”] CMD [“-v”]
(Simplified) Dockerfile for PHP FROM ubuntu:17.04 RUN apt install -y
php-cli COPY hello.php /code WORKDIR /code ENTRYPOINT [“php”] CMD [“-v”]
(Simplified) Dockerfile for PHP FROM ubuntu:17.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 ◍ Virtualisation ◍ Image Delivery ◍
Orchestration (Dev) ➔ docker build ➔ docker run ➔ docker push / pull ➔ docker-compose
Virtualisation Running Docker Images as Containers
Demo
Docker ◍ Image Builder ◍ Virtualisation ◍ Image Delivery ◍
Orchestration (Dev) ➔ docker build ➔ docker run ➔ docker push / pull ➔ docker-compose
Orchestration (Dev) Composing Services
Your Super Application
Your Super Application
Docker Compose
docker-compose.yml version: “3”
docker-compose.yml version: “3” services: php: image: php:7 ports: - 80:80
volumes: - .:/code
docker-compose.yml version: “3” services: php: image: php:7 … database: image:
mariadb:latest environment: MYSQL_USERNAME: rawkode MYSQL_PASSWORD: *******
docker-compose.yml version: “3” services: php: image: php:7 … database: image:
mariadb:latest environment: MYSQL_USERNAME: rawkode MYSQL_PASSWORD: *******
docker-compose.yml version: “3” services: php: image: php:7 healthcheck: test: nc
-z localhost 80 depends_on: - database
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
Tips: Use Random Ports services: php: ports: - 80
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
Tips: Prune docker system prune Docker CE >= 17.04
Tips: env_file Lots of environment variables defined inside compose.yml? Duplication?
env_file: - some file
Tips: Alpine Linux Unless you need Ubuntu / Fedora, use
Alpine Linux Ubuntu -- 130MB Alpine -- 3.99MB
Tips: Keep a Single Dockerfile Using MultiStage Builds, you can
usually keep your project to a single Dockerfile FROM node AS node RUN npm install FROM php COPY --from=node assets
Tips: Don’t Bust Your Build Cache COPY composer.json /code RUN
composer install COPY . /code
Tips: Logging ALWAYS LOG to STDOUT
Production Tip Mandatory Requirement --read-only
Warning Microservices
“ That which is old will be new again
Microservices
Microservices
Microservices
Microservices
Microservices
What is old will be new again Shared Kubernetes Dev
Server
Microservices
Shared Kubernetes Dev Server Tooling Skaffold github.com/GoogleContainerTools/skaffold Draft github.com/Azure/draft Telepresence
github.com/telepresenceio/telepresence
Shared Kubernetes Dev Server Tooling Istio github.com/istio/istio Linkerd linkerd/linkerd2 Consul
Connect github.com/hashicorp/consul
Creating a fast Kubernetes Development Workflow Bastian Hofmann / 1140
/ Track B
Questions?