From d26bde9941b65d3aff5b670abbcb0994f666e2d5 Mon Sep 17 00:00:00 2001 From: nicosommi Date: Thu, 2 Feb 2017 12:26:19 -0300 Subject: [PATCH] adds a command called dserve-php that runs an apache with php --- plugins/docker-common/README.md | 10 ++++++++++ plugins/docker-common/_docker-common | 7 +++++++ 2 files changed, 17 insertions(+) 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)