SlideShare a Scribd company logo
1 of 159
Download to read offline
Converting Your Dev Environment
to a Docker Stack
Dana Luther
https://joind.in/talk/4321c
https://git.io/JeB1S
@danaluther
Consolidated Work Stack
PHP 7.3 FPM
NGINX
MySQL
Consolidated Work Stack
Friend A
PHP 5.6
Apache
MySQL
PHP 7.3 FPM
NGINX
MySQL
Consolidated Work Stack
Friend A
PHP 5.6
Apache
MySQL
Cause B
PHP 7.1 FPM
NGINX
MySQL
PHP 7.3 FPM
NGINX
MySQL
Licensed
Application
Licensed
Application
PHP 5.6
Apache
MySQL 5.3
Client A
Licensed
Application
PHP 5.6
Apache
MySQL 5.3
Client A
Client B
PHP 7.1
Apache
MySQL 5.4
Licensed
Application
Client C
PHP 5.6 FPM
NGINX
MySQL 5.2
PHP 5.6
Apache
MySQL 5.3
Client A
Client B
PHP 7.1
Apache
MySQL 5.4
Licensed
Application
Client D
PHP 7.1 FPM
NGINX
MySQL 5.3
Client C
PHP 5.6 FPM
NGINX
MySQL 5.2
PHP 5.6
Apache
MySQL 5.3
Client A
Client B
PHP 7.1
Apache
MySQL 5.4
THERE IS A
BETTER
WAY
THERE IS A
BETTER
WAY
VM
PHP 7.0 FPM
NGINX
MySQL
VM
PHP 7.0 FPM
NGINX
MySQL
So, how does that work???
🤔
?
? ?
?
docker-compose.yml
Docker Compose Version
Services in the Stack
Configurations,
Secrets,
Storage Volumes,
etc.
Version: “3.7”
services:
nginx:
image: nginx
command: [
'sh',
'-c',
"exec nginx -g 'daemon off;'"
]
…
php:
image: php:7.3-fpm
…
network:
web_frontend
config:
nginx.conf:
file: ./nginx/nginx.conf
volumes:
…https://docs.docker.com/compose/compose-file/
SIDEBAR:The Docker Hierarchy
SIDEBAR:The Docker Hierarchy
Image Container Service Stack
SIDEBAR:The Docker Hierarchy
Image Container Service Stack
Node Swarm
> docker stack deploy …
Swarm
NODE 1
NODE 2
ETC.
PHP 1 MySQL
NGINX PHP 2
SIDEBAR:Docker Command Syntax
docker (object) (action) (args)
SIDEBAR:Docker Command Syntax
docker (object) (action) (args)
> docker container ls
SIDEBAR:Docker Command Syntax
docker (object) (action) (args)
> docker container ls
> docker image ls
SIDEBAR:Docker Command Syntax
docker (object) (action) (args)
> docker container ls
> docker image ls
> docker service ls
SIDEBAR:Docker Command Syntax
docker (object) (action) (args)
> docker container ls
> docker image ls
> docker service ls
> docker volume ls
SIDEBAR:Docker Command Syntax
docker (object) (action) (args)
> docker container ls
> docker image ls
> docker service ls
> docker volume ls
image
container
stack
service
config
network
node
plugin
swarm
Objects
SIDEBAR:Docker Command Syntax
docker (object) (action) (args)
> docker container ls
> docker image ls
> docker service ls
> docker volume ls
image
container
stack
service
config
network
node
plugin
swarm
Objects
ls
ps
prune
inspect
create
remove / rm
Common
Actions
The swarm …
Node
Manager
Node
Worker
Node
Worker
Node
Worker
Node
Manager
A SWARM OF ONE
> docker swarm init
Node
Manager
A SWARM OF ONE
> docker swarm init
⚠ Common “Gotcha”
Swarm init — ONE TIME ONLY
* THE SWARM PERSISTS *
⚠ Common “Gotcha”
Swarm init — ONE TIME ONLY
* THE SWARM PERSISTS *
> docker swarm leave
⚠ Common “Gotcha”
Swarm init — ONE TIME ONLY
* THE SWARM PERSISTS *
> docker swarm leave
> docker swarm leave —force
POPQUIZ!
POPQUIZ! A. What’s the difference
between a container and a
service?
POPQUIZ! A. What’s the difference
between a container and a
service?
B. What’s the difference
between a service and a
stack?
Commonly Useful Images:
mysql
php
nginx
httpd
node
redis
wordpress
composer
memcached
alpine
postgres
busybox
https://store.docker.com
Commonly Useful Images:
mysql
php
nginx
httpd
node
redis
wordpress
composer
memcached
alpine
postgres
busybox
phpmyadmin/phpmyadmin
https://store.docker.com
Commonly Useful Images:
mysql
php
nginx
httpd
node
redis
wordpress
composer
memcached
alpine
postgres
busybox
phpmyadmin/phpmyadmin
https://store.docker.com
BONUS POP QUIZ!
Commonly Useful Images:
mysql
php
nginx
httpd
node
redis
wordpress
composer
memcached
alpine
postgres
busybox
phpmyadmin/phpmyadmin
https://store.docker.com
BONUS POP QUIZ!
How do you pull an image manually?
Commonly Useful Images:
mysql
php
nginx
httpd
node
redis
wordpress
composer
memcached
alpine
postgres
busybox
phpmyadmin/phpmyadmin
https://store.docker.com
> docker image pull mysql:latest
BONUS POP QUIZ!
How do you pull an image manually?
Images for Automated Testing
selenium/standalone-chrome-debug
selenium/standalone-firefox-debug:2.53.0
acceptance.suite.yml
docker-compose.yml
Images for Automated Testing
selenium/standalone-chrome-debug
selenium/standalone-firefox-debug:2.53.0
acceptance.suite.yml
docker-compose.yml
SIDEBAR:Legacy images, containers, volumes
> docker image prune
> docker container prune
> docker (whatever) prune
SIDEBAR:Legacy images, containers, volumes
> docker image prune
> docker container prune
> docker (whatever) prune
> docker system prune
SIDEBAR:Legacy images, containers, volumes
> docker image prune
> docker container prune
> docker (whatever) prune
> docker system prune
SIDEBAR:Legacy images, containers, volumes
> docker image prune
> docker container prune
> docker (whatever) prune
> docker system prune
SIDEBAR:Legacy images, containers, volumes
> docker image prune
> docker container prune
> docker (whatever) prune
> docker system prune
version: “3.7”
services:
nginx:
image: nginx
networks:
- web
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “Nginx Service”
volumes:
- ./public_html:/var/ www/html
configs:
- source: mysite
target: /etc/nginx/conf.d/mysite.conf
ports:
- “80:80”
- “443:443”
depends_on:
- php
- db
labels:
com.envisageinternational.desc: “Nginx Container”
command: [‘sh’,'-c',"exec nginx -g 'daemon off;’”]
db:
image: mysql
ports:
- “3306:3306”
networks:
- web
secrets:
- db_pwd
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints: [ node.role == manager ]
environment:
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_pwd
php:
image: php:7.3-fpm
networks:
- web
depends_on:
- db
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “PHP-FPM Service”
ports:
- “9000:9000”
volumes:
- ./public_html:/var/ www/html
labels:
com.envisageinternational.desc: “PHP-FPM Container”
php-cli:
image: php:7.3-cli
networks:
- web
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “PHP-CLI Service”
volumes:
- ./public_html:/var/ www/html
labels:
com.envisageinternational.desc: “PHP-CLI Container”
command: [‘bin/sh’, ‘-c’, “sleep infinity”]
networks:
web:
configs:
mysite:
file: ./mysite.conf
secrets:
db_pwd:
file: ./root_db_password.txt
PHP 7.3 FPM
NGINX
MySQL
php:
image: php:7.3-fpm
networks:
- web
depends_on:
- db
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “PHP-FPM Service”
ports:
- “9000:9000”
volumes:
- ./public_html:/var/ www/html
labels:
com.envisageinternational.desc: “PHP-FPM Container”
php-cli:
image: php:7.3-cli
networks:
- web
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “PHP-CLI Service”
volumes:
- ./public_html:/var/ www/html
labels:
com.envisageinternational.desc: “PHP-CLI Container”
command: [‘bin/sh’, ‘-c’, “sleep infinity”]
networks:
web:
configs:
mysite:
file: ./mysite.conf
secrets:
db_pwd:
file: ./root_db_password.txt
version: “3.7”
services:
nginx:
image: nginx
networks:
- web
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “Nginx Service”
volumes:
- ./public_html:/var/ www/html
configs:
- source: mysite
target: /etc/nginx/conf.d/mysite.conf
ports:
- “80:80”
- “443:443”
depends_on:
- php
- db
labels:
com.envisageinternational.desc: “Nginx Container”
command: [‘sh’,'-c',"exec nginx -g 'daemon off;’”]
db:
image: mysql
ports:
- “3306:3306”
networks:
- web
secrets:
- db_pwd
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints: [ node.role == manager ]
environment:
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_pwd
PHP 7.0 FPM
NGINX
MySQL
php:
image: php:7.3-fpm
networks:
- web
depends_on:
- db
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “PHP-FPM Service”
ports:
- “9000:9000”
volumes:
- ./public_html:/var/ www/html
labels:
com.envisageinternational.desc: “PHP-FPM Container”
php-cli:
image: php:7.3-cli
networks:
- web
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “PHP-CLI Service”
volumes:
- ./public_html:/var/ www/html
labels:
com.envisageinternational.desc: “PHP-CLI Container”
command: [‘bin/sh’, ‘-c’, “sleep infinity”]
networks:
web:
configs:
mysite:
file: ./mysite.conf
secrets:
db_pwd:
file: ./root_db_password.txt
nginx:
image: nginx
networks:
- web
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “Nginx Service”
volumes:
- ./public_html:/var/ www/html
configs:
- source: mysite
target: /etc/nginx/conf.d/mysite.conf
ports:
- “80:80”
- “443:443”
depends_on:
- php
- db
labels:
com.envisageinternational.desc: “Nginx Container”
command: [‘sh’,'-c',"exec nginx -g 'daemon off;’”]
PHP 7.0 FPM
NGINX
MySQL
php:
image: php:7.3-fpm
networks:
- web
depends_on:
- db
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “PHP-FPM Service”
ports:
- “9000:9000”
volumes:
- ./public_html:/var/ www/html
labels:
com.envisageinternational.desc: “PHP-FPM Container”
php-cli:
image: php:7.3-cli
networks:
- web
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “PHP-CLI Service”
volumes:
- ./public_html:/var/ www/html
labels:
com.envisageinternational.desc: “PHP-CLI Container”
command: [‘bin/sh’, ‘-c’, “sleep infinity”]
networks:
web:
configs:
mysite:
file: ./mysite.conf
secrets:
db_pwd:
file: ./root_db_password.txt
nginx:
image: nginx
networks:
- web
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “Nginx Service”
volumes:
- ./public_html:/var/ www/html
configs:
- source: mysite
target: /etc/nginx/conf.d/mysite.conf
ports:
- “80:80”
- “443:443”
depends_on:
- php
- db
labels:
com.envisageinternational.desc: “Nginx Container”
command: [‘sh’,'-c',"exec nginx -g 'daemon off;’”]
PHP 7.0 FPM
NGINX
MySQL
SIDEBAR:LABELS — use them everywhere!
🤔
?
? ?
? The -f toggle
-f name=phpworld_php
-f label=com.envisage.desc=php
SIDEBAR:LABELS — use them everywhere!
🤔
?
? ?
? The -f toggle
-f name=phpworld_php
-f label=com.envisage.desc=php
SIDEBAR:LABELS — use them everywhere!
🤔
?
? ?
? The -f toggle
-f name=phpworld_php
-f label=com.envisage.desc=php
SIDEBAR:LABELS — use them everywhere!
🤔
?
? ?
? The -f toggle
-f name=phpworld_php
-f label=com.envisage.desc=php
version: “3.7”
services:
nginx:
image: nginx
networks:
- web
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “Nginx Service”
volumes:
- ./public_html:/var/ www/html
configs:
- source: mysite
target: /etc/nginx/conf.d/mysite.conf
ports:
- “80:80”
- “443:443”
depends_on:
- php
- db
labels:
com.envisageinternational.desc: “Nginx Container”
command: [‘sh’,'-c',"exec nginx -g 'daemon off;’”]
db:
image: mysql
ports:
- “3306:3306”
networks:
- web
secrets:
- db_pwd
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints: [ node.role == manager ]
environment:
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_pwd
php:
image: php:7.0-fpm
networks:
- web
depends_on:
- db
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “PHP-FPM Service”
ports:
- “9000:9000”
volumes:
- ./public_html:/var/ www/html
labels:
com.envisageinternational.desc: “PHP-FPM Container”
php-cli:
image: php:7.0-cli
networks:
- web
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “PHP-CLI Service”
volumes:
- ./public_html:/var/ www/html
labels:
com.envisageinternational.desc: “PHP-CLI Container”
command: [‘bin/sh’, ‘-c’, “sleep infinity”]
networks:
web:
configs:
mysite:
file: ./mysite.conf
secrets:
db_pwd:
file: ./root_db_password.txt
PHP 7.0 FPM
NGINX
MySQL
Volume Example for php
php:
volumes:
- ./public_html:/var/ www/html
Local path relative
to the file
Path location within
the container
Using named storage volumes
Volumes:
pub_html:
external: true
…
php:
volumes:
- pub_html:/var/ www/html
Volume name
Path location
within the container
> docker volume create pub_html 
—opt type=none 
—opt o=bind 
—opt device=/Volumes/E/site/ 
—label “com.envisage.desc=Site”
Using named storage volumes
> docker volume create pub_html 
—opt type=none 
—opt o=bind 
—opt device=/Volumes/E/site/ 
—label “com.envisage.desc=Site”
⚠ Common “Gotcha”
* BEWARE WINDOWS PATHS *
C:DockerDriveSite
/C/DockerDrives/Site
/host_mnt/c/DockerDrives/Site
//c/DockerDrives/Site
Windows
LCOW
Volume
Path
POPQUIZ!
POPQUIZ! A. What is the command to
initialize a swarm?
POPQUIZ! A. What is the command to
initialize a swarm?
B. What is the command to
deploy a docker stack?
> docker stack deploy -c docker-compose.yml phpworld
> docker stack deploy -c docker-compose.yml phpworld
> docker stack deploy -c docker-compose.yml phpworld
🤔
?
? ?
?
> docker stack deploy -c docker-compose.yml phpworld
🤔
?
? ?
?
> docker service ls
> docker stack deploy -c docker-compose.yml phpworld
🤔
?
? ?
?
> docker service ls
> docker stack deploy -c docker-compose.yml phpworld
🤔
?
? ?
?
> docker service ls
> docker stack deploy -c docker-compose.yml phpworld
🤔
?
? ?
?
> docker service ls
> docker stack deploy -c docker-compose.yml phpworld
🤔
?
? ?
?
> docker service ls
> docker stack ps phpworld
> docker stack deploy -c docker-compose.yml phpworld
🤔
?
? ?
?
> docker service ls
> docker stack ps phpworld
> docker service logs phpworld_db
> docker service logs phpworld_db
> docker service logs phpworld_db
> docker service logs phpworld_db
Want to see it in action?
> docker service logs phpworld_nginx -f
Want to see it in action?
> docker service logs phpworld_nginx -f
⚠ Common “Gotcha”
localhost:3306 db:3306
⚠ Common “Gotcha”
localhost:3306 db:3306
upstream fastcgi {
server 127.0.0.1:9000
}
upstream fastcgi {
server php:9000
}
Ok, great! But … 	 ¯_(ツ)_/¯
My production server
has lots of configurations
that have been customized…
php/conf.d/*
my.cnf
nginx.conf
nginx/conf.d/*
version: “3.7”
services:
nginx:
image: nginx
networks:
- web
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “Nginx Service”
volumes:
- ./public_html:/var/ www/html
configs:
- source: mysite
target: /etc/nginx/conf.d/mysite.conf
ports:
- “80:80”
- “443:443”
depends_on:
- php
- db
labels:
com.envisageinternational.desc: “Nginx Container”
command: [‘sh’,'-c',"exec nginx -g 'daemon off;’”]
db:
image: mysql
ports:
- “3306:3306”
networks:
- web
secrets:
- db_pwd
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints: [ node.role == manager ]
environment:
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_pwd
php:
image: php:7.3-fpm
networks:
- web
depends_on:
- db
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “PHP-FPM Service”
ports:
- “9000:9000”
volumes:
- ./public_html:/var/ www/html
labels:
com.envisageinternational.desc: “PHP-FPM Container”
php-cli:
image: php:7.3-cli
networks:
- web
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “PHP-CLI Service”
volumes:
- ./public_html:/var/ www/html
labels:
com.envisageinternational.desc: “PHP-CLI Container”
command: [‘bin/sh’, ‘-c’, “sleep infinity”]
networks:
web:
configs:
mysite:
file: ./mysite.conf
secrets:
db_pwd:
file: ./root_db_password.txt
PHP 7.0 FPM
NGINX
MySQL
version: “3.7”
services:
nginx:
image: nginx
networks:
- web
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “Nginx Service”
volumes:
- ./public_html:/var/ www/html
configs:
- source: mysite
target: /etc/nginx/conf.d/mysite.conf
ports:
- “80:80”
- “443:443”
depends_on:
- php
- db
labels:
com.envisageinternational.desc: “Nginx Container”
command: [‘sh’,'-c',"exec nginx -g 'daemon off;’”]
db:
image: mysql
ports:
- “3306:3306”
networks:
- web
secrets:
- db_pwd
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints: [ node.role == manager ]
environment:
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_pwd
networks:
- web
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.d
volumes:
- ./public_html:/var/ www/html
labels:
com.envisageinternational.de
command: [‘bin/sh’, ‘-c’, “sleep
networks:
web:
configs:
mysite:
file: ./mysite.conf
secrets:
PHP 7.0 FPM
NGINX
MySQL
Config: mysite
Config: mysite
> docker config inspect phpworld_mysite
version: “3.4”
services:
nginx:
image: nginx
networks:
- web
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “Nginx Service”
volumes:
- ./public_html:/var/ www/html
configs:
- source: mysite
target: /etc/nginx/conf.d/mysite.conf
ports:
- “80:80”
- “443:443”
depends_on:
- php
- db
labels:
com.envisageinternational.desc: “Nginx Container”
command: [‘sh’,'-c',"exec nginx -g 'daemon off;’”]
db:
image: mysql
ports:
- “3306:3306”
networks:
- web
secrets:
- db_pwd
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints: [ node.role == manager ]
environment:
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_pwd
php:
image: php:7.3-fpm
networks:
- web
depends_on:
- db
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “PHP-FPM Service”
ports:
- “9000:9000”
volumes:
- ./public_html:/var/ www/html
labels:
com.envisageinternational.desc: “PHP-FPM Container”
php-cli:
image: php:7.3-cli
networks:
- web
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
com.envisageinternational.desc: “PHP-CLI Service”
volumes:
- ./public_html:/var/ www/html
labels:
com.envisageinternational.desc: “PHP-CLI Container”
command: [‘bin/sh’, ‘-c’, “sleep infinity”]
networks:
web:
configs:
mysite:
file: ./mysite.conf
secrets:
db_pwd:
file: ./root_db_password.txt
PHP 7.0 FPM
NGINX
MySQL
Secret: db_pwd
Secret: db_pwd
> docker secret inspect phpworld_db_pwd
⚠ Common “Gotcha”
> docker config ls
⚠ Common “Gotcha”
> docker config ls
⚠ Common “Gotcha”
> docker config create mysite.2 ./mysite.conf
> docker config ls
⚠ Common “Gotcha”
> docker config create mysite.2 ./mysite.conf
> docker config ls
⚠ Common “Gotcha”
> docker config create mysite.2 ./mysite.conf
> docker config ls
⚠ Common “Gotcha”
> docker config create mysite.2 ./mysite.conf
> docker config ls
⚠ Common “Gotcha”
> docker config create mysite.2 ./mysite.conf
> docker config ls
> docker service update --config-rm phpworld_mysite 
--config-add source=mysite.2,target=/etc/nginx/conf.d/default.conf 
phpworld_nginx
⚠ Common “Gotcha”
> docker config create mysite.2 ./mysite.conf
> docker config ls
> docker service update --config-rm phpworld_mysite 
--config-add source=mysite.2,target=/etc/nginx/conf.d/default.conf 
phpworld_nginx
> docker service rollback phpworld_nginx
> docker service rollback phpworld_nginx
Done with the project for now?
> docker stack rm phpworld
Done with the project for now?
> docker stack rm phpworld
Done with the project for now?
> docker stack rm phpworld
Done with the project for now?
> docker stack rm phpworld
POPQUIZ!
POPQUIZ! A. How do you check the
replication status of services?
POPQUIZ! A. How do you check the
replication status of services?
B. How do you check for error
messages on the stack?
POPQUIZ! A. How do you check the
replication status of services?
B. How do you check for error
messages on the stack?
BONUS POINT
POPQUIZ! A. How do you check the
replication status of services?
B. How do you check for error
messages on the stack?
BONUS POINT
How do you avoid truncating the error message?
POPQUIZ! A. How do you check the
replication status of services?
B. How do you check for error
messages on the stack?
> docker stack ps vm --no-trunc
BONUS POINT
How do you avoid truncating the error message?
Same project … multiple production
targets?
docker-compose.yml
docker-compose-clientA.yml
docker-compose-clientB.yml
Same project … multiple production
targets?
docker-compose.yml
docker-compose-clientA.yml
docker-compose-clientB.yml
Same project … multiple production
targets?
docker-compose.yml
docker-compose-clientA.yml
docker-compose-clientB.yml
Same project … multiple production
targets?
docker-compose.yml
docker-compose-clientA.yml
docker-compose-clientB.yml
POPQUIZ!
POPQUIZ! A. How do you filter a list of
docker objects (services,
containers, images, etc)
SIDEBAR:The $( ) magic with -q -l -f
-q Quiet (ID only)
-l Last Updated Only (1 result)
-f Filter (you remember this)
SIDEBAR:The $( ) magic with -q -l -f
-q Quiet (ID only)
-l Last Updated Only (1 result)
-f Filter (you remember this)
> docker container ls -q -l
SIDEBAR:The $( ) magic with -q -l -f
-q Quiet (ID only)
-l Last Updated Only (1 result)
-f Filter (you remember this)
> docker container ls -q -l
SIDEBAR:The $( ) magic with -q -l -f
-q Quiet (ID only)
-l Last Updated Only (1 result)
-f Filter (you remember this)
> docker container ls -q -l
> docker container exec -it $(docker ps -lq -f name=phpworld_nginx) bash
SIDEBAR:The $( ) magic with -q -l -f
-q Quiet (ID only)
-l Last Updated Only (1 result)
-f Filter (you remember this)
> docker container ls -q -l
> docker container exec -it $(docker ps -lq -f name=phpworld_nginx) bash
Don’t love the command prompt?
🤔
?
? ??
Don’t love the command prompt?
POPQUIZ!
POPQUIZ!A. What is the command to
deploy a stack?
POPQUIZ!A. What is the command to
deploy a stack?
SIDEBAR:Multi-stage builds
> docker image build -f images/Dockerfile-bundled 
--target=phpworld_php 
-t dhluther/php:phpworld-demo .
> docker image build -f images/Dockerfile-bundled 
--target=phpworld_nginx 
-t dhluther/nginx:phpworld-demo .
POPQUIZ!
POPQUIZ!A. Command line equivalent?
POPQUIZ!A. Command line equivalent?
> docker service ls -f name=phpworld
POPQUIZ!
POPQUIZ!A. Command line equivalent?
POPQUIZ!A. Command line equivalent?
> docker container ls
> docker container exec -it 
$(docker ps -lq -f name=phpworld_php) 
bash
> docker service update
--config-add source=mysite.2,target=/etc/nginx/conf.d/default.conf 
phpworld_nginx
Command line equivalent?
> docker node ls
Questions??
https://joind.in/talk/4321c
🤔
?
? ?
?
@danaluther
https://www.linkedin.com/in/danaluther
dluther@envisageinternational.com
https://git.io/JeB1S
Converting Your Dev Environment to a Docker Stack - php[world]

More Related Content

What's hot

Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleStein Inge Morisbak
 
Badge Poser v3.0 - A DevOps Journey
Badge Poser v3.0 - A DevOps JourneyBadge Poser v3.0 - A DevOps Journey
Badge Poser v3.0 - A DevOps JourneyFabio Cicerchia
 
ZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small TeamsZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small TeamsJoe Ferguson
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer ToolboxPablo Godel
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.catPablo Godel
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient waySylvain Rayé
 
Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariJoseph Scott
 
Single page apps with drupal 7
Single page apps with drupal 7Single page apps with drupal 7
Single page apps with drupal 7Chris Tankersley
 
今すぐ始めるCloud Foundry #hackt #hackt_k
今すぐ始めるCloud Foundry #hackt #hackt_k今すぐ始めるCloud Foundry #hackt #hackt_k
今すぐ始めるCloud Foundry #hackt #hackt_kToshiaki Maki
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionBen Hall
 
A Node.JS bag of goodies for analyzing Web Traffic
A Node.JS bag of goodies for analyzing Web TrafficA Node.JS bag of goodies for analyzing Web Traffic
A Node.JS bag of goodies for analyzing Web TrafficPhilip Tellis
 
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony Apps
Symfony Live NYC 2014 -  Rock Solid Deployment of Symfony AppsSymfony Live NYC 2014 -  Rock Solid Deployment of Symfony Apps
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony AppsPablo Godel
 
Configuring Django projects for multiple environments
Configuring Django projects for multiple environmentsConfiguring Django projects for multiple environments
Configuring Django projects for multiple environmentsApptension
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Ben Hall
 
Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!Jeff Jones
 
Web frameworks don't matter
Web frameworks don't matterWeb frameworks don't matter
Web frameworks don't matterTomas Doran
 

What's hot (20)

Scaling Django
Scaling DjangoScaling Django
Scaling Django
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
 
Badge Poser v3.0 - A DevOps Journey
Badge Poser v3.0 - A DevOps JourneyBadge Poser v3.0 - A DevOps Journey
Badge Poser v3.0 - A DevOps Journey
 
ZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small TeamsZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small Teams
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
 
Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to Ferrari
 
Taming AEM deployments
Taming AEM deploymentsTaming AEM deployments
Taming AEM deployments
 
Single page apps with drupal 7
Single page apps with drupal 7Single page apps with drupal 7
Single page apps with drupal 7
 
今すぐ始めるCloud Foundry #hackt #hackt_k
今すぐ始めるCloud Foundry #hackt #hackt_k今すぐ始めるCloud Foundry #hackt #hackt_k
今すぐ始めるCloud Foundry #hackt #hackt_k
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 
A Node.JS bag of goodies for analyzing Web Traffic
A Node.JS bag of goodies for analyzing Web TrafficA Node.JS bag of goodies for analyzing Web Traffic
A Node.JS bag of goodies for analyzing Web Traffic
 
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony Apps
Symfony Live NYC 2014 -  Rock Solid Deployment of Symfony AppsSymfony Live NYC 2014 -  Rock Solid Deployment of Symfony Apps
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony Apps
 
Configuring Django projects for multiple environments
Configuring Django projects for multiple environmentsConfiguring Django projects for multiple environments
Configuring Django projects for multiple environments
 
Front-end tools
Front-end toolsFront-end tools
Front-end tools
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)
 
Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!
 
Web frameworks don't matter
Web frameworks don't matterWeb frameworks don't matter
Web frameworks don't matter
 
Plack at OSCON 2010
Plack at OSCON 2010Plack at OSCON 2010
Plack at OSCON 2010
 

Similar to Converting Your Dev Environment to a Docker Stack - php[world]

Converting your DEV Environment to a Docker Stack - ZCOE18
Converting your DEV Environment to a Docker Stack - ZCOE18Converting your DEV Environment to a Docker Stack - ZCOE18
Converting your DEV Environment to a Docker Stack - ZCOE18Dana Luther
 
Converting Your DEV Environment to a Docker Stack
Converting Your DEV Environment to a Docker StackConverting Your DEV Environment to a Docker Stack
Converting Your DEV Environment to a Docker StackDana Luther
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Ben Hall
 
桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作Philip Zheng
 
How to install and configure LEMP stack
How to install and configure LEMP stackHow to install and configure LEMP stack
How to install and configure LEMP stackRootGate
 
Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year laterChristian Ortner
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slidesDocker, Inc.
 
Wordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionWordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionSysdig
 
PHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the CloudPHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the CloudSalesforce Developers
 
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google CloudDrupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google CloudDropsolid
 
ApacheCon 2014 - What's New in Apache httpd 2.4
ApacheCon 2014 - What's New in Apache httpd 2.4ApacheCon 2014 - What's New in Apache httpd 2.4
ApacheCon 2014 - What's New in Apache httpd 2.4Jim Jagielski
 
The Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressThe Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressJeroen van Dijk
 
Docker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak PeekDocker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak Peekmsyukor
 
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境謝 宗穎
 
Automação do físico ao NetSecDevOps
Automação do físico ao NetSecDevOpsAutomação do físico ao NetSecDevOps
Automação do físico ao NetSecDevOpsRaul Leite
 
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOpsОмские ИТ-субботники
 
Instrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con GitlabInstrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con GitlabSoftware Guru
 
Nats meetup oct 2016 docker 112
Nats meetup oct 2016 docker 112Nats meetup oct 2016 docker 112
Nats meetup oct 2016 docker 112Nirmal Mehta
 

Similar to Converting Your Dev Environment to a Docker Stack - php[world] (20)

Converting your DEV Environment to a Docker Stack - ZCOE18
Converting your DEV Environment to a Docker Stack - ZCOE18Converting your DEV Environment to a Docker Stack - ZCOE18
Converting your DEV Environment to a Docker Stack - ZCOE18
 
Converting Your DEV Environment to a Docker Stack
Converting Your DEV Environment to a Docker StackConverting Your DEV Environment to a Docker Stack
Converting Your DEV Environment to a Docker Stack
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
 
桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作
 
How to install and configure LEMP stack
How to install and configure LEMP stackHow to install and configure LEMP stack
How to install and configure LEMP stack
 
Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year later
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
Wordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionWordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccion
 
Automation day red hat ansible
   Automation day red hat ansible    Automation day red hat ansible
Automation day red hat ansible
 
PHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the CloudPHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the Cloud
 
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google CloudDrupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
 
ApacheCon 2014 - What's New in Apache httpd 2.4
ApacheCon 2014 - What's New in Apache httpd 2.4ApacheCon 2014 - What's New in Apache httpd 2.4
ApacheCon 2014 - What's New in Apache httpd 2.4
 
The Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressThe Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/Press
 
Docker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak PeekDocker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak Peek
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
 
Automação do físico ao NetSecDevOps
Automação do físico ao NetSecDevOpsAutomação do físico ao NetSecDevOps
Automação do físico ao NetSecDevOps
 
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
 
Instrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con GitlabInstrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con Gitlab
 
Nats meetup oct 2016 docker 112
Nats meetup oct 2016 docker 112Nats meetup oct 2016 docker 112
Nats meetup oct 2016 docker 112
 

More from Dana Luther

Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
How to analyze your codebase with Exakat using Docker - Longhorn PHP
How to analyze your codebase with Exakat using Docker - Longhorn PHPHow to analyze your codebase with Exakat using Docker - Longhorn PHP
How to analyze your codebase with Exakat using Docker - Longhorn PHPDana Luther
 
Keep it Secret, Keep it Safe - Docker Secrets and DI
Keep it Secret, Keep it Safe - Docker Secrets and DIKeep it Secret, Keep it Safe - Docker Secrets and DI
Keep it Secret, Keep it Safe - Docker Secrets and DIDana Luther
 
Integrated Feature Management - Using Feature Flags - PHPSerbia
Integrated Feature Management - Using Feature Flags - PHPSerbiaIntegrated Feature Management - Using Feature Flags - PHPSerbia
Integrated Feature Management - Using Feature Flags - PHPSerbiaDana Luther
 
Integrated Feature Management - Using Feature Flags - MidwestPHP
Integrated Feature Management - Using Feature Flags - MidwestPHPIntegrated Feature Management - Using Feature Flags - MidwestPHP
Integrated Feature Management - Using Feature Flags - MidwestPHPDana Luther
 
Integrated Feature Management - Using Feature Flags - SunshinePHP
Integrated Feature Management - Using Feature Flags - SunshinePHPIntegrated Feature Management - Using Feature Flags - SunshinePHP
Integrated Feature Management - Using Feature Flags - SunshinePHPDana Luther
 
Code Coverage for Total Security in Application Migrations
Code Coverage for Total Security in Application MigrationsCode Coverage for Total Security in Application Migrations
Code Coverage for Total Security in Application MigrationsDana Luther
 

More from Dana Luther (7)

Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
How to analyze your codebase with Exakat using Docker - Longhorn PHP
How to analyze your codebase with Exakat using Docker - Longhorn PHPHow to analyze your codebase with Exakat using Docker - Longhorn PHP
How to analyze your codebase with Exakat using Docker - Longhorn PHP
 
Keep it Secret, Keep it Safe - Docker Secrets and DI
Keep it Secret, Keep it Safe - Docker Secrets and DIKeep it Secret, Keep it Safe - Docker Secrets and DI
Keep it Secret, Keep it Safe - Docker Secrets and DI
 
Integrated Feature Management - Using Feature Flags - PHPSerbia
Integrated Feature Management - Using Feature Flags - PHPSerbiaIntegrated Feature Management - Using Feature Flags - PHPSerbia
Integrated Feature Management - Using Feature Flags - PHPSerbia
 
Integrated Feature Management - Using Feature Flags - MidwestPHP
Integrated Feature Management - Using Feature Flags - MidwestPHPIntegrated Feature Management - Using Feature Flags - MidwestPHP
Integrated Feature Management - Using Feature Flags - MidwestPHP
 
Integrated Feature Management - Using Feature Flags - SunshinePHP
Integrated Feature Management - Using Feature Flags - SunshinePHPIntegrated Feature Management - Using Feature Flags - SunshinePHP
Integrated Feature Management - Using Feature Flags - SunshinePHP
 
Code Coverage for Total Security in Application Migrations
Code Coverage for Total Security in Application MigrationsCode Coverage for Total Security in Application Migrations
Code Coverage for Total Security in Application Migrations
 

Recently uploaded

哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查ydyuyu
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasDigicorns Technologies
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsMonica Sydney
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdfMatthew Sinclair
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...kajalverma014
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoilmeghakumariji156
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsMonica Sydney
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查ydyuyu
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsMonica Sydney
 
Microsoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftMicrosoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftAanSulistiyo
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdfMatthew Sinclair
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdfMatthew Sinclair
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.krishnachandrapal52
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxgalaxypingy
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样ayvbos
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptxAsmae Rabhi
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制pxcywzqs
 

Recently uploaded (20)

哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency Dallas
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
Microsoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftMicrosoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck Microsoft
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptx
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
 

Converting Your Dev Environment to a Docker Stack - php[world]

  • 1. Converting Your Dev Environment to a Docker Stack Dana Luther https://joind.in/talk/4321c https://git.io/JeB1S @danaluther
  • 2. Consolidated Work Stack PHP 7.3 FPM NGINX MySQL
  • 3. Consolidated Work Stack Friend A PHP 5.6 Apache MySQL PHP 7.3 FPM NGINX MySQL
  • 4. Consolidated Work Stack Friend A PHP 5.6 Apache MySQL Cause B PHP 7.1 FPM NGINX MySQL PHP 7.3 FPM NGINX MySQL
  • 7. Licensed Application PHP 5.6 Apache MySQL 5.3 Client A Client B PHP 7.1 Apache MySQL 5.4
  • 8. Licensed Application Client C PHP 5.6 FPM NGINX MySQL 5.2 PHP 5.6 Apache MySQL 5.3 Client A Client B PHP 7.1 Apache MySQL 5.4
  • 9. Licensed Application Client D PHP 7.1 FPM NGINX MySQL 5.3 Client C PHP 5.6 FPM NGINX MySQL 5.2 PHP 5.6 Apache MySQL 5.3 Client A Client B PHP 7.1 Apache MySQL 5.4
  • 14. So, how does that work??? 🤔 ? ? ? ?
  • 15. docker-compose.yml Docker Compose Version Services in the Stack Configurations, Secrets, Storage Volumes, etc. Version: “3.7” services: nginx: image: nginx command: [ 'sh', '-c', "exec nginx -g 'daemon off;'" ] … php: image: php:7.3-fpm … network: web_frontend config: nginx.conf: file: ./nginx/nginx.conf volumes: …https://docs.docker.com/compose/compose-file/
  • 17. SIDEBAR:The Docker Hierarchy Image Container Service Stack
  • 18. SIDEBAR:The Docker Hierarchy Image Container Service Stack Node Swarm
  • 19. > docker stack deploy … Swarm NODE 1 NODE 2 ETC. PHP 1 MySQL NGINX PHP 2
  • 20. SIDEBAR:Docker Command Syntax docker (object) (action) (args)
  • 21. SIDEBAR:Docker Command Syntax docker (object) (action) (args) > docker container ls
  • 22. SIDEBAR:Docker Command Syntax docker (object) (action) (args) > docker container ls > docker image ls
  • 23. SIDEBAR:Docker Command Syntax docker (object) (action) (args) > docker container ls > docker image ls > docker service ls
  • 24. SIDEBAR:Docker Command Syntax docker (object) (action) (args) > docker container ls > docker image ls > docker service ls > docker volume ls
  • 25. SIDEBAR:Docker Command Syntax docker (object) (action) (args) > docker container ls > docker image ls > docker service ls > docker volume ls image container stack service config network node plugin swarm Objects
  • 26. SIDEBAR:Docker Command Syntax docker (object) (action) (args) > docker container ls > docker image ls > docker service ls > docker volume ls image container stack service config network node plugin swarm Objects ls ps prune inspect create remove / rm Common Actions
  • 28. Node Manager A SWARM OF ONE > docker swarm init
  • 29. Node Manager A SWARM OF ONE > docker swarm init
  • 30. ⚠ Common “Gotcha” Swarm init — ONE TIME ONLY * THE SWARM PERSISTS *
  • 31. ⚠ Common “Gotcha” Swarm init — ONE TIME ONLY * THE SWARM PERSISTS * > docker swarm leave
  • 32. ⚠ Common “Gotcha” Swarm init — ONE TIME ONLY * THE SWARM PERSISTS * > docker swarm leave > docker swarm leave —force
  • 34. POPQUIZ! A. What’s the difference between a container and a service?
  • 35. POPQUIZ! A. What’s the difference between a container and a service? B. What’s the difference between a service and a stack?
  • 41. Images for Automated Testing selenium/standalone-chrome-debug selenium/standalone-firefox-debug:2.53.0 acceptance.suite.yml docker-compose.yml
  • 42. Images for Automated Testing selenium/standalone-chrome-debug selenium/standalone-firefox-debug:2.53.0 acceptance.suite.yml docker-compose.yml
  • 43. SIDEBAR:Legacy images, containers, volumes > docker image prune > docker container prune > docker (whatever) prune
  • 44. SIDEBAR:Legacy images, containers, volumes > docker image prune > docker container prune > docker (whatever) prune > docker system prune
  • 45. SIDEBAR:Legacy images, containers, volumes > docker image prune > docker container prune > docker (whatever) prune > docker system prune
  • 46. SIDEBAR:Legacy images, containers, volumes > docker image prune > docker container prune > docker (whatever) prune > docker system prune
  • 47. SIDEBAR:Legacy images, containers, volumes > docker image prune > docker container prune > docker (whatever) prune > docker system prune
  • 48. version: “3.7” services: nginx: image: nginx networks: - web deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “Nginx Service” volumes: - ./public_html:/var/ www/html configs: - source: mysite target: /etc/nginx/conf.d/mysite.conf ports: - “80:80” - “443:443” depends_on: - php - db labels: com.envisageinternational.desc: “Nginx Container” command: [‘sh’,'-c',"exec nginx -g 'daemon off;’”] db: image: mysql ports: - “3306:3306” networks: - web secrets: - db_pwd deploy: replicas: 1 restart_policy: condition: on-failure placement: constraints: [ node.role == manager ] environment: - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_pwd php: image: php:7.3-fpm networks: - web depends_on: - db deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “PHP-FPM Service” ports: - “9000:9000” volumes: - ./public_html:/var/ www/html labels: com.envisageinternational.desc: “PHP-FPM Container” php-cli: image: php:7.3-cli networks: - web deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “PHP-CLI Service” volumes: - ./public_html:/var/ www/html labels: com.envisageinternational.desc: “PHP-CLI Container” command: [‘bin/sh’, ‘-c’, “sleep infinity”] networks: web: configs: mysite: file: ./mysite.conf secrets: db_pwd: file: ./root_db_password.txt PHP 7.3 FPM NGINX MySQL
  • 49. php: image: php:7.3-fpm networks: - web depends_on: - db deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “PHP-FPM Service” ports: - “9000:9000” volumes: - ./public_html:/var/ www/html labels: com.envisageinternational.desc: “PHP-FPM Container” php-cli: image: php:7.3-cli networks: - web deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “PHP-CLI Service” volumes: - ./public_html:/var/ www/html labels: com.envisageinternational.desc: “PHP-CLI Container” command: [‘bin/sh’, ‘-c’, “sleep infinity”] networks: web: configs: mysite: file: ./mysite.conf secrets: db_pwd: file: ./root_db_password.txt version: “3.7” services: nginx: image: nginx networks: - web deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “Nginx Service” volumes: - ./public_html:/var/ www/html configs: - source: mysite target: /etc/nginx/conf.d/mysite.conf ports: - “80:80” - “443:443” depends_on: - php - db labels: com.envisageinternational.desc: “Nginx Container” command: [‘sh’,'-c',"exec nginx -g 'daemon off;’”] db: image: mysql ports: - “3306:3306” networks: - web secrets: - db_pwd deploy: replicas: 1 restart_policy: condition: on-failure placement: constraints: [ node.role == manager ] environment: - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_pwd PHP 7.0 FPM NGINX MySQL
  • 50. php: image: php:7.3-fpm networks: - web depends_on: - db deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “PHP-FPM Service” ports: - “9000:9000” volumes: - ./public_html:/var/ www/html labels: com.envisageinternational.desc: “PHP-FPM Container” php-cli: image: php:7.3-cli networks: - web deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “PHP-CLI Service” volumes: - ./public_html:/var/ www/html labels: com.envisageinternational.desc: “PHP-CLI Container” command: [‘bin/sh’, ‘-c’, “sleep infinity”] networks: web: configs: mysite: file: ./mysite.conf secrets: db_pwd: file: ./root_db_password.txt nginx: image: nginx networks: - web deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “Nginx Service” volumes: - ./public_html:/var/ www/html configs: - source: mysite target: /etc/nginx/conf.d/mysite.conf ports: - “80:80” - “443:443” depends_on: - php - db labels: com.envisageinternational.desc: “Nginx Container” command: [‘sh’,'-c',"exec nginx -g 'daemon off;’”] PHP 7.0 FPM NGINX MySQL
  • 51. php: image: php:7.3-fpm networks: - web depends_on: - db deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “PHP-FPM Service” ports: - “9000:9000” volumes: - ./public_html:/var/ www/html labels: com.envisageinternational.desc: “PHP-FPM Container” php-cli: image: php:7.3-cli networks: - web deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “PHP-CLI Service” volumes: - ./public_html:/var/ www/html labels: com.envisageinternational.desc: “PHP-CLI Container” command: [‘bin/sh’, ‘-c’, “sleep infinity”] networks: web: configs: mysite: file: ./mysite.conf secrets: db_pwd: file: ./root_db_password.txt nginx: image: nginx networks: - web deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “Nginx Service” volumes: - ./public_html:/var/ www/html configs: - source: mysite target: /etc/nginx/conf.d/mysite.conf ports: - “80:80” - “443:443” depends_on: - php - db labels: com.envisageinternational.desc: “Nginx Container” command: [‘sh’,'-c',"exec nginx -g 'daemon off;’”] PHP 7.0 FPM NGINX MySQL
  • 52. SIDEBAR:LABELS — use them everywhere! 🤔 ? ? ? ? The -f toggle -f name=phpworld_php -f label=com.envisage.desc=php
  • 53. SIDEBAR:LABELS — use them everywhere! 🤔 ? ? ? ? The -f toggle -f name=phpworld_php -f label=com.envisage.desc=php
  • 54. SIDEBAR:LABELS — use them everywhere! 🤔 ? ? ? ? The -f toggle -f name=phpworld_php -f label=com.envisage.desc=php
  • 55. SIDEBAR:LABELS — use them everywhere! 🤔 ? ? ? ? The -f toggle -f name=phpworld_php -f label=com.envisage.desc=php
  • 56. version: “3.7” services: nginx: image: nginx networks: - web deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “Nginx Service” volumes: - ./public_html:/var/ www/html configs: - source: mysite target: /etc/nginx/conf.d/mysite.conf ports: - “80:80” - “443:443” depends_on: - php - db labels: com.envisageinternational.desc: “Nginx Container” command: [‘sh’,'-c',"exec nginx -g 'daemon off;’”] db: image: mysql ports: - “3306:3306” networks: - web secrets: - db_pwd deploy: replicas: 1 restart_policy: condition: on-failure placement: constraints: [ node.role == manager ] environment: - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_pwd php: image: php:7.0-fpm networks: - web depends_on: - db deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “PHP-FPM Service” ports: - “9000:9000” volumes: - ./public_html:/var/ www/html labels: com.envisageinternational.desc: “PHP-FPM Container” php-cli: image: php:7.0-cli networks: - web deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “PHP-CLI Service” volumes: - ./public_html:/var/ www/html labels: com.envisageinternational.desc: “PHP-CLI Container” command: [‘bin/sh’, ‘-c’, “sleep infinity”] networks: web: configs: mysite: file: ./mysite.conf secrets: db_pwd: file: ./root_db_password.txt PHP 7.0 FPM NGINX MySQL
  • 57. Volume Example for php php: volumes: - ./public_html:/var/ www/html Local path relative to the file Path location within the container
  • 58. Using named storage volumes Volumes: pub_html: external: true … php: volumes: - pub_html:/var/ www/html Volume name Path location within the container > docker volume create pub_html —opt type=none —opt o=bind —opt device=/Volumes/E/site/ —label “com.envisage.desc=Site”
  • 59. Using named storage volumes > docker volume create pub_html —opt type=none —opt o=bind —opt device=/Volumes/E/site/ —label “com.envisage.desc=Site”
  • 60. ⚠ Common “Gotcha” * BEWARE WINDOWS PATHS * C:DockerDriveSite /C/DockerDrives/Site /host_mnt/c/DockerDrives/Site //c/DockerDrives/Site Windows LCOW Volume Path
  • 61.
  • 63. POPQUIZ! A. What is the command to initialize a swarm?
  • 64. POPQUIZ! A. What is the command to initialize a swarm? B. What is the command to deploy a docker stack?
  • 65. > docker stack deploy -c docker-compose.yml phpworld
  • 66. > docker stack deploy -c docker-compose.yml phpworld
  • 67. > docker stack deploy -c docker-compose.yml phpworld 🤔 ? ? ? ?
  • 68. > docker stack deploy -c docker-compose.yml phpworld 🤔 ? ? ? ? > docker service ls
  • 69. > docker stack deploy -c docker-compose.yml phpworld 🤔 ? ? ? ? > docker service ls
  • 70. > docker stack deploy -c docker-compose.yml phpworld 🤔 ? ? ? ? > docker service ls
  • 71. > docker stack deploy -c docker-compose.yml phpworld 🤔 ? ? ? ? > docker service ls
  • 72. > docker stack deploy -c docker-compose.yml phpworld 🤔 ? ? ? ? > docker service ls > docker stack ps phpworld
  • 73. > docker stack deploy -c docker-compose.yml phpworld 🤔 ? ? ? ? > docker service ls > docker stack ps phpworld
  • 74. > docker service logs phpworld_db
  • 75. > docker service logs phpworld_db
  • 76. > docker service logs phpworld_db
  • 77. > docker service logs phpworld_db
  • 78.
  • 79.
  • 80. Want to see it in action? > docker service logs phpworld_nginx -f
  • 81. Want to see it in action? > docker service logs phpworld_nginx -f
  • 83. ⚠ Common “Gotcha” localhost:3306 db:3306 upstream fastcgi { server 127.0.0.1:9000 } upstream fastcgi { server php:9000 }
  • 84. Ok, great! But … ¯_(ツ)_/¯ My production server has lots of configurations that have been customized… php/conf.d/* my.cnf nginx.conf nginx/conf.d/*
  • 85. version: “3.7” services: nginx: image: nginx networks: - web deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “Nginx Service” volumes: - ./public_html:/var/ www/html configs: - source: mysite target: /etc/nginx/conf.d/mysite.conf ports: - “80:80” - “443:443” depends_on: - php - db labels: com.envisageinternational.desc: “Nginx Container” command: [‘sh’,'-c',"exec nginx -g 'daemon off;’”] db: image: mysql ports: - “3306:3306” networks: - web secrets: - db_pwd deploy: replicas: 1 restart_policy: condition: on-failure placement: constraints: [ node.role == manager ] environment: - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_pwd php: image: php:7.3-fpm networks: - web depends_on: - db deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “PHP-FPM Service” ports: - “9000:9000” volumes: - ./public_html:/var/ www/html labels: com.envisageinternational.desc: “PHP-FPM Container” php-cli: image: php:7.3-cli networks: - web deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “PHP-CLI Service” volumes: - ./public_html:/var/ www/html labels: com.envisageinternational.desc: “PHP-CLI Container” command: [‘bin/sh’, ‘-c’, “sleep infinity”] networks: web: configs: mysite: file: ./mysite.conf secrets: db_pwd: file: ./root_db_password.txt PHP 7.0 FPM NGINX MySQL
  • 86. version: “3.7” services: nginx: image: nginx networks: - web deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “Nginx Service” volumes: - ./public_html:/var/ www/html configs: - source: mysite target: /etc/nginx/conf.d/mysite.conf ports: - “80:80” - “443:443” depends_on: - php - db labels: com.envisageinternational.desc: “Nginx Container” command: [‘sh’,'-c',"exec nginx -g 'daemon off;’”] db: image: mysql ports: - “3306:3306” networks: - web secrets: - db_pwd deploy: replicas: 1 restart_policy: condition: on-failure placement: constraints: [ node.role == manager ] environment: - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_pwd networks: - web deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.d volumes: - ./public_html:/var/ www/html labels: com.envisageinternational.de command: [‘bin/sh’, ‘-c’, “sleep networks: web: configs: mysite: file: ./mysite.conf secrets: PHP 7.0 FPM NGINX MySQL
  • 88. Config: mysite > docker config inspect phpworld_mysite
  • 89. version: “3.4” services: nginx: image: nginx networks: - web deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “Nginx Service” volumes: - ./public_html:/var/ www/html configs: - source: mysite target: /etc/nginx/conf.d/mysite.conf ports: - “80:80” - “443:443” depends_on: - php - db labels: com.envisageinternational.desc: “Nginx Container” command: [‘sh’,'-c',"exec nginx -g 'daemon off;’”] db: image: mysql ports: - “3306:3306” networks: - web secrets: - db_pwd deploy: replicas: 1 restart_policy: condition: on-failure placement: constraints: [ node.role == manager ] environment: - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_pwd php: image: php:7.3-fpm networks: - web depends_on: - db deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “PHP-FPM Service” ports: - “9000:9000” volumes: - ./public_html:/var/ www/html labels: com.envisageinternational.desc: “PHP-FPM Container” php-cli: image: php:7.3-cli networks: - web deploy: replicas: 1 restart_policy: condition: on-failure labels: com.envisageinternational.desc: “PHP-CLI Service” volumes: - ./public_html:/var/ www/html labels: com.envisageinternational.desc: “PHP-CLI Container” command: [‘bin/sh’, ‘-c’, “sleep infinity”] networks: web: configs: mysite: file: ./mysite.conf secrets: db_pwd: file: ./root_db_password.txt PHP 7.0 FPM NGINX MySQL
  • 91. Secret: db_pwd > docker secret inspect phpworld_db_pwd
  • 92. ⚠ Common “Gotcha” > docker config ls
  • 93. ⚠ Common “Gotcha” > docker config ls
  • 94. ⚠ Common “Gotcha” > docker config create mysite.2 ./mysite.conf > docker config ls
  • 95. ⚠ Common “Gotcha” > docker config create mysite.2 ./mysite.conf > docker config ls
  • 96. ⚠ Common “Gotcha” > docker config create mysite.2 ./mysite.conf > docker config ls
  • 97. ⚠ Common “Gotcha” > docker config create mysite.2 ./mysite.conf > docker config ls
  • 98. ⚠ Common “Gotcha” > docker config create mysite.2 ./mysite.conf > docker config ls > docker service update --config-rm phpworld_mysite --config-add source=mysite.2,target=/etc/nginx/conf.d/default.conf phpworld_nginx
  • 99. ⚠ Common “Gotcha” > docker config create mysite.2 ./mysite.conf > docker config ls > docker service update --config-rm phpworld_mysite --config-add source=mysite.2,target=/etc/nginx/conf.d/default.conf phpworld_nginx
  • 100.
  • 101. > docker service rollback phpworld_nginx
  • 102. > docker service rollback phpworld_nginx
  • 103. Done with the project for now? > docker stack rm phpworld
  • 104. Done with the project for now? > docker stack rm phpworld
  • 105. Done with the project for now? > docker stack rm phpworld
  • 106. Done with the project for now? > docker stack rm phpworld
  • 108. POPQUIZ! A. How do you check the replication status of services?
  • 109. POPQUIZ! A. How do you check the replication status of services? B. How do you check for error messages on the stack?
  • 110. POPQUIZ! A. How do you check the replication status of services? B. How do you check for error messages on the stack? BONUS POINT
  • 111. POPQUIZ! A. How do you check the replication status of services? B. How do you check for error messages on the stack? BONUS POINT How do you avoid truncating the error message?
  • 112. POPQUIZ! A. How do you check the replication status of services? B. How do you check for error messages on the stack? > docker stack ps vm --no-trunc BONUS POINT How do you avoid truncating the error message?
  • 113. Same project … multiple production targets? docker-compose.yml docker-compose-clientA.yml docker-compose-clientB.yml
  • 114. Same project … multiple production targets? docker-compose.yml docker-compose-clientA.yml docker-compose-clientB.yml
  • 115. Same project … multiple production targets? docker-compose.yml docker-compose-clientA.yml docker-compose-clientB.yml
  • 116. Same project … multiple production targets? docker-compose.yml docker-compose-clientA.yml docker-compose-clientB.yml
  • 118. POPQUIZ! A. How do you filter a list of docker objects (services, containers, images, etc)
  • 119. SIDEBAR:The $( ) magic with -q -l -f -q Quiet (ID only) -l Last Updated Only (1 result) -f Filter (you remember this)
  • 120. SIDEBAR:The $( ) magic with -q -l -f -q Quiet (ID only) -l Last Updated Only (1 result) -f Filter (you remember this) > docker container ls -q -l
  • 121. SIDEBAR:The $( ) magic with -q -l -f -q Quiet (ID only) -l Last Updated Only (1 result) -f Filter (you remember this) > docker container ls -q -l
  • 122. SIDEBAR:The $( ) magic with -q -l -f -q Quiet (ID only) -l Last Updated Only (1 result) -f Filter (you remember this) > docker container ls -q -l > docker container exec -it $(docker ps -lq -f name=phpworld_nginx) bash
  • 123. SIDEBAR:The $( ) magic with -q -l -f -q Quiet (ID only) -l Last Updated Only (1 result) -f Filter (you remember this) > docker container ls -q -l > docker container exec -it $(docker ps -lq -f name=phpworld_nginx) bash
  • 124. Don’t love the command prompt?
  • 125. 🤔 ? ? ?? Don’t love the command prompt?
  • 126.
  • 127.
  • 129. POPQUIZ!A. What is the command to deploy a stack?
  • 130. POPQUIZ!A. What is the command to deploy a stack?
  • 131.
  • 132.
  • 133.
  • 135.
  • 136. > docker image build -f images/Dockerfile-bundled --target=phpworld_php -t dhluther/php:phpworld-demo . > docker image build -f images/Dockerfile-bundled --target=phpworld_nginx -t dhluther/nginx:phpworld-demo .
  • 137.
  • 138.
  • 139.
  • 140.
  • 142. POPQUIZ!A. Command line equivalent?
  • 143. POPQUIZ!A. Command line equivalent? > docker service ls -f name=phpworld
  • 144.
  • 145.
  • 147. POPQUIZ!A. Command line equivalent?
  • 148. POPQUIZ!A. Command line equivalent? > docker container ls
  • 149.
  • 150. > docker container exec -it $(docker ps -lq -f name=phpworld_php) bash
  • 151.
  • 152.
  • 153.
  • 154. > docker service update --config-add source=mysite.2,target=/etc/nginx/conf.d/default.conf phpworld_nginx Command line equivalent?
  • 155.
  • 157.