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
Godot Engineについて調べてみた
unsoluble_sugar
0
390
KMP with Crashlytics
sansantech
PRO
0
240
0→1事業こそPMは営業すべし / pmconf #落選お披露目 / PM should do sales in zero to one
roki_n_
PRO
1
1.4k
技術に触れたり、顔を出そう
maruto
1
150
信頼されるためにやったこと、 やらなかったこと。/What we did to be trusted, What we did not do.
bitkey
PRO
0
2.2k
あなたの知らないクラフトビールの世界
miura55
0
120
AWSサービスアップデート 2024/12 Part3
nrinetcom
PRO
0
140
東京Ruby会議12 Ruby と Rust と私 / Tokyo RubyKaigi 12 Ruby, Rust and me
eagletmt
3
870
[IBM TechXchange Dojo]Watson Discoveryとwatsonx.aiでRAGを実現!事例のご紹介+座学②
siyuanzh09
0
110
コロプラのオンボーディングを採用から語りたい
colopl
5
1.2k
CDKのコードレビューを楽にするパッケージcdk-mentorを作ってみた/cdk-mentor
tomoki10
0
210
FODにおけるホーム画面編成のレコメンド
watarukudo
PRO
2
270
Featured
See All Featured
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
How STYLIGHT went responsive
nonsquared
96
5.3k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Git: the NoSQL Database
bkeepers
PRO
427
64k
BBQ
matthewcrist
85
9.4k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.2k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
570
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
What's in a price? How to price your products and services
michaelherold
244
12k
Unsuck your backbone
ammeep
669
57k
Making the Leap to Tech Lead
cromwellryan
133
9k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
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?