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
92
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
180
Cloud Native Telegraf - Cloud Native London (September 2019)
rawkode
0
42
Developing Your Own Flux Packages (InfluxDays London 2019)
rawkode
0
120
Introduction to Time Series (Software Circus, April 2019)
rawkode
0
130
Introduction to Time Series (Cloud Native Kraków, April 2019)
rawkode
0
88
Introduction to Time Series (Cloud Native Wales, April 2019)
rawkode
0
79
Introduction to InfluxDB 2.0 (Kubernetes London - February 2019)
rawkode
0
54
LaraconEU 2018 - Kickass Development Environments with Docker
rawkode
2
290
Other Decks in Technology
See All in Technology
実践的なバグバウンティ入門
scgajge12
4
2.1k
APIのドキュメント化何使ってますか?
miu_crescent
2
160
いまからでも遅くない! コンテナでWebアプリケーションを 動かしてみよう(1)Gitハンズオン
nomu
0
280
Zero Data Loss Autonomous Recovery Service サービス概要
oracle4engineer
PRO
0
3.1k
タイミーのBraze活用 ~PUSH通知を活用したレコメンド~
ozeshun
2
120
SHIFTの課題と目指したい組織像 / 20240827 Rinto Ikenoue
shift_evolve
0
140
LLM を現場で評価する
asei
4
670
脆弱星に導かれて
nishimunea
1
1.5k
中規模・ミドルTier開発組織におけるDevRelの戦略と実行と成果 - DevRel Guild Conference Mini -
leveragestech
2
260
Datadog を使ったプロダクトとクラウドの セキュリティモニタリング
mrtc0
0
450
疎通2024
sadnessojisan
4
460
PlaywrightによるE2Eテスト入門 / Introduction to E2E Testing with Playwright
rhumie
3
900
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
363
22k
How to train your dragon (web standard)
notwaldorf
85
5.6k
Building Flexible Design Systems
yeseniaperezcruz
324
37k
Art, The Web, and Tiny UX
lynnandtonic
294
20k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
41
6.4k
The Straight Up "How To Draw Better" Workshop
denniskardys
230
130k
Visualization
eitanlees
142
15k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
28
2.2k
Imperfection Machines: The Place of Print at Facebook
scottboms
263
13k
Making the Leap to Tech Lead
cromwellryan
128
8.8k
Robots, Beer and Maslow
schacon
PRO
157
8.1k
Building a Modern Day E-commerce SEO Strategy
aleyda
35
6.8k
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?