Changes web project layout, keeping mysql folder outside

parent 0de6a6c5
...@@ -10,26 +10,35 @@ cd lampserver ...@@ -10,26 +10,35 @@ cd lampserver
docker build . -t lampserver docker build . -t lampserver
``` ```
# Starting your web project
You need to create a folder where your web files and the database will reside.
```
# create a project directory
mkdir my-web-project
cd my-web-project
# create a subdirectory for web files
mkdir www
```
Inside `my-web-project/www` you place your web files.
# Running the server # Running the server
Go to the directory **where your web files are placed**, and run: Go to your web project directory (e.g., `my-web-project`) and run:
``` ```
docker run -it -e PHP_DISPLAY_ERRORS=On -e DOCKER_USER_ID=`id -u \`whoami\`` \ docker run -it -e APACHE_ROOT=www -e PHP_DISPLAY_ERRORS=On \
-p "80:80" -v ${PWD}:/app -v ${PWD}/mysql:/var/lib/mysql --name lampserver-1 \ -e DOCKER_USER_ID=`id -u \`whoami\`` -p "80:80" -v ${PWD}:/app \
--rm lampserver -v ${PWD}/mysql:/var/lib/mysql --name lampserver-1 --rm lampserver
``` ```
`lampserver-1` is the name of the docker *container*, i.e, a running instance `lampserver-1` is the name of the docker *container*, i.e., a running instance
of the `lampserver` image. of the `lampserver` image.
The first time you run the server in your directory, a MySQL data folder will The first time you run the server in your directory, a MySQL data folder will
be created inside your web directory under `./mysql` be created inside your project directory `./mysql`
(you can change this if you want changing
`-v <directory_for_mysql_data>:/var/lib/mysql`).
A password for the `admin` user of MySQL is shown the first time. A password for the `admin` user of MySQL is shown the first time.
Your server is available at: http://localhost
Your server is available at: http://localhost (if you want to use another port (if you want to use another port of your host machine, change `-p "80:80"`
of your host machine, change `-p "80:80"` by `-p "<another_port>:80"`) by `-p "<another_port>:80"`)
# Using MySQL # Using MySQL
1. You can use PHPMyAdmin by going to http://localhost/phpmyadmin. You have 1. You can use PHPMyAdmin by going to http://localhost/phpmyadmin. You have
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment