Skip to content

Commit

Permalink
convert p03 md to rst
Browse files Browse the repository at this point in the history
  • Loading branch information
rimelek committed Feb 20, 2021
1 parent a261e41 commit d2c80ae
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ If it does not exist or empty, then set the value manually or run the script bel
All off the examples were tested with Docker 20.10.1. The version of Docker Compose was 1.27.4.
You can try with more recent versions but some behaviour could be different in the future.

* [p03](projects/p03/READMe.md): Create your own PHP application with built-in PHP web server.
* [p04](projects/p04/README.md): Create a simple [Docker Compose](https://docs.docker.com/compose/) project.
* [p05](projects/p05/README.md): Communication of PHP and Apache HTTPD web serverwith the help of [Docker Compose](https://docs.docker.com/compose/).
* [p06](projects/p06/README.md): Run more [Docker Compose](https://docs.docker.com/compose/) project on the same port using [nginx-proxy](https://hub.docker.com/r/jwilder/nginx-proxy).
Expand All @@ -89,4 +88,5 @@ You can try with more recent versions but some behaviour could be different in t

projects/p00
projects/p01
projects/p02
projects/p02
projects/p03
46 changes: 25 additions & 21 deletions projects/p03/READMe.md → docs/projects/p03.rst
Original file line number Diff line number Diff line change
@@ -1,45 +1,49 @@
============================================================
Create your own PHP application with built-in PHP web server
============================================================

Build an image:

```bash
docker build -t localhost/p03_php .
```
.. code:: bash
docker build -t localhost/p03_php .
Start the container:

```bash
docker run -d --name p03_php -p "8080:80" localhost/p03_php
```
.. code:: bash
docker run -d --name p03_php -p "8080:80" localhost/p03_php
Open in a web browser and reload the page multiple times.
You can see the output is different each time with more lines.

Now delete the container. Probably you already now how, but as a reminder I show you again:

```bash
docker rm -f p03_php
```
.. code:: bash
docker rm -f p03_php
Execute the "docker run ..." command again and reload the example web page to
see how you have lost the previously generated lines and delete the container again.

Now start the container with a volume to preserve data:

```bash
docker run -d --mount source=p03_php_www,target=/var/www --name p03_php -p "8080:80" localhost/p03_php
```
.. code:: bash
docker run -d --mount source=p03_php_www,target=/var/www --name p03_php -p "8080:80" localhost/p03_php
This way you can delete and create the container repeatedly a you will never lose your data until you delete the volume.
You can see all volumes with the following command:

```bash
docker volume ls
# or
docker volume list
```
.. code:: bash
docker volume ls
# or
docker volume list
After you have deleted the container, you can delete the volume:

```bash
docker volume rm p03_php_www
```
.. code:: bash
[Back to the main page](../../README.md)
docker volume rm p03_php_www

0 comments on commit d2c80ae

Please sign in to comment.