docker run \
--rm \
--publish "80:80" \
--workdir "/www/localhost/public" \
--name "dev_simple_82" \
--hostname "dev-82" \
--add-host="host.docker.internal:host-gateway" \
"gander/dev:8.2"
Open: localhost
SSL with mkcert
mkcert -install
mkcert localhost
docker run \
--rm \
--publish "80:80" \
--publish "443:443" \
--volume "${PWD}/localhost.pem:/etc/ssl/certs/ssl-cert-snakeoil.pem:ro" \
--volume "${PWD}/localhost-key.pem:/etc/ssl/private/ssl-cert-snakeoil.key:ro" \
--workdir "/www/localhost/public" \
--name "dev_ssl_82" \
--hostname "dev-82" \
--add-host="host.docker.internal:host-gateway" \
"gander/dev:8.2"
- Open: localhost over HTTP
- Open: localhost over HTTPS
Example docker-compose.yml configuration
docker-compose up
File | Settings | PHP | Debug
File | Settings | PHP | Servers
These settings refer to the configuration in the docker-compose.yml file:
Name | Host | Port | Debugger | File/Directory | Absolute path on the server |
---|---|---|---|---|---|
dev.56 |
localhost |
8056 |
Xdebug | examples |
/www/localhost/public |
dev.70 |
localhost |
8070 |
Xdebug | examples |
/www/localhost/public |
dev.71 |
localhost |
8071 |
Xdebug | examples |
/www/localhost/public |
dev.72 |
localhost |
8072 |
Xdebug | examples |
/www/localhost/public |
dev.73 |
localhost |
8073 |
Xdebug | examples |
/www/localhost/public |
dev.74 |
localhost |
8074 |
Xdebug | examples |
/www/localhost/public |
dev.80 |
localhost |
8080 |
Xdebug | examples |
/www/localhost/public |
dev.81 |
localhost |
8081 |
Xdebug | examples |
/www/localhost/public |
dev.82 |
localhost |
8082 |
Xdebug | examples |
/www/localhost/public |
extra_hosts:
- "host.docker.internal:host-gateway"
extra_hosts:
- "host.docker.internal:${HOST_DOCKER_INTERNAL}"
HOST_DOCKER_INTERNAL=$(hostname -I | awk '{print $1}') docker-compose up
docker run --add-host="host.docker.internal:$(hostname -I | awk '{print $1}')"
export XDEBUG_SESSION=1
export XDEBUG_CONFIG=1
php script1.php
php script2.php
php script3.php
unset XDEBUG_SESSION
unset XDEBUG_CONFIG
or:
XDEBUG_SESSION=1 XDEBUG_CONFIG=1 php script.php
or:
docker-compose exec dev56 bash -c 'XDEBUG_SESSION=1 XDEBUG_CONFIG=1 php index.php'
docker-compose exec dev70 bash -c 'XDEBUG_SESSION=1 XDEBUG_CONFIG=1 php index.php'
docker-compose exec dev71 bash -c 'XDEBUG_SESSION=1 XDEBUG_CONFIG=1 php index.php'
docker-compose exec dev72 bash -c 'XDEBUG_SESSION=1 XDEBUG_CONFIG=1 php index.php'
docker-compose exec dev73 bash -c 'XDEBUG_SESSION=1 XDEBUG_CONFIG=1 php index.php'
docker-compose exec dev74 bash -c 'XDEBUG_SESSION=1 XDEBUG_CONFIG=1 php index.php'
docker-compose exec dev80 bash -c 'XDEBUG_SESSION=1 XDEBUG_CONFIG=1 php index.php'
docker-compose exec dev81 bash -c 'XDEBUG_SESSION=1 XDEBUG_CONFIG=1 php index.php'
docker-compose exec dev82 bash -c 'XDEBUG_SESSION=1 XDEBUG_CONFIG=1 php index.php'