Jeroen Boersma
Jeroen Boersma
And again ... Learn docker
Docker / docker-compose
compose for automating, easy to use .yml files
version: '2'
networks: {}
volumes:
dockerdev-mysql-volume:
external: true
services:
db:
image: percona
volumes:
- ./conf.d/mysql:/etc/mysql/conf.d:ro
- dockerdev-mysql-volume:/var/lib/mysql:rw
env_file:
- ./conf/mysql
network_mode: bridge
ports:
- 127.0.0.1:3306:3306
mailcatch:
image: mailhog/mailhog
network_mode: bridge
php:
build:
context: php7
links:
./bin/dev [COMMAND]
docker-compose-blackfireclient.yml, docker-compose-linux.yml, docker-custom.yml, docker-compose-blackfire.yml,
docker-compose-mytop.yml, docker-sync.yml,
docker-compose-ctop.yml, docker-compose-osx.yml,
docker-compose-dbclient.yml, docker-compose.yml
Only automated builds with Dockerfile
Install docker (apt/whatever) / docker-compose min 1.6.1
git clone git@github.com:JeroenBoersma/docker-compose-development.git development
vi conf/mysql
# Set MYSQL_ROOT_PASSWORD=ANYTHINGNOTTOSIMPLE
./bin/dev up
# Will download all images
# Will set some local settings for local users
# Will try to start all containers
# MAKE SURE NO LOCAL MySQL/Webserver is running anymore
Was the biggest speed problem for MacOS
Sync files from local ./mysql -> /var/lib/mysql
Solved via a persistent data container
docker volume create dockerdev-mysql-volume
The ./workspace directory is mapped to /data internally
./workspace/test/project -> /data/test/project
(htdocs|public|httpdocs|pub) are your public
http(s)://test.project.dev/
/data/test/project/public/index.php
./workspace/test/project/public/index.php
*.dev -> 127.0.0.1 (via hosts or local dns)
still on my todo: making this configurable
Default PHP 7.0
$ dev up
Creating development_db_1
Creating development_blackfire_1
Creating development_mailcatch_1
Creating development_redis_1
Creating development_php_1
Creating development_php71_1
Creating development_php5_1
Creating development_web_1
Via ./bin/dev [COMMAND]
Run ./bin/dev profile and add to your profile
$ ./bin/dev profile
export PATH=/home/jeroen/docker/development/bin:${PATH};
alias cdw='cd /home/jeroen/docker/development/workspace';
Len Lorijn (symfony)
Peter Jaap Blaakmeer (magento2)
Caroga (Silex)
Berkan Duzgun (MacOS)
Elze Kool (fpm upstream)
Oscar Recio (MacOS)
$ dev down
Stopping development_web_1 ... done
Stopping development_php5_1 ... done
Stopping development_php71_1 ... done
Stopping development_php_1 ... done
Stopping development_redis_1 ... done
Stopping development_mailcatch_1 ... done
Stopping development_blackfire_1 ... done
Stopping development_db_1 ... done
Removing development_web_1 ... done
Removing development_php5_1 ... done
Removing development_php71_1 ... done
Removing development_php_1 ... done
Removing development_redis_1 ... done
Removing development_mailcatch_1 ... done
Removing development_blackfire_1 ... done
Removing development_db_1 ... done
Volume dockerdev-mysql-volume is external, skipping