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
95
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
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
55
LaraconEU 2018 - Kickass Development Environments with Docker
rawkode
2
290
Other Decks in Technology
See All in Technology
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
120
iOS/Androidで同じUI体験をネ イティブで作成する際に気をつ けたい落とし穴
fumiyasac0921
1
110
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
250
第1回 国土交通省 データコンペ参加者向け勉強会③- Snowflake x estie編 -
estie
0
120
Making your applications cross-environment - OSCG 2024 NA
salaboy
0
180
VideoMamba: State Space Model for Efficient Video Understanding
chou500
0
190
ドメインの本質を掴む / Get the essence of the domain
sinsoku
2
150
隣接領域をBeyondするFinatextのエンジニア組織設計 / beyond-engineering-areas
stajima
1
270
いざ、BSC討伐の旅
nikinusu
2
780
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.1k
The Role of Developer Relations in AI Product Success.
giftojabu1
0
120
Lexical Analysis
shigashiyama
1
150
Featured
See All Featured
A better future with KSS
kneath
238
17k
A Tale of Four Properties
chriscoyier
156
23k
Done Done
chrislema
181
16k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Designing Experiences People Love
moore
138
23k
How GitHub (no longer) Works
holman
310
140k
Happy Clients
brianwarren
98
6.7k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Become a Pro
speakerdeck
PRO
25
5k
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?