diff --git a/plugins/docker-common/README.md b/plugins/docker-common/README.md index a4dea2e2..afd13d01 100644 --- a/plugins/docker-common/README.md +++ b/plugins/docker-common/README.md @@ -12,6 +12,16 @@ docker dstop dserve-myStaticFolder docker rm dserve-myStaticFolder ``` +## Dserve-php +```bash +cd /myStaticFolder +dserve-php # It will lift an apache and output the port used on the host +# After you used it you can stop and remove it easily by name +# all the created container names will start with the dserve-php prefix +docker dstop dserve-php-myStaticFolder +docker rm dserve-php-myStaticFolder +``` + ### Doc This run command has many scenarios, this is just a basic configuration. ```bash diff --git a/plugins/docker-common/_docker-common b/plugins/docker-common/_docker-common index 9d9ad8c1..bc63e3a6 100644 --- a/plugins/docker-common/_docker-common +++ b/plugins/docker-common/_docker-common @@ -5,6 +5,13 @@ dserve() { && docker port $container } +dserve-php() { + local container=dserve-php-${$(pwd)//\//-} + (docker restart $container \ + || docker run -d --name $container -P -v "$(pwd):/var/www/html:ro" php:5-apache) \ + && docker port $container +} + doc() { # TODO: add zsh conf # bind shell so we can change current dir (cd, etc)