# LAMP (Linux/Apache/MySQL/PHP) This LAMP docker image is based on `mattrayner/lamp:latest-1604` image. You have more detailed information at https://hub.docker.com/r/mattrayner/lamp/ # Build the image First, you have to build the docker image. This process has to be done only once. ``` git clone https://www.sing-group.org/dt/gitlab/dgpena/lampserver cd lampserver docker build . -t lampserver ``` # Running the server Go to the directory **where your web files are placed**, and run: ``` docker run -it -e PHP_DISPLAY_ERRORS=On -e DOCKER_USER_ID=`id -u \`whoami\`` \ -p "80:80" -v ${PWD}:/app -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 of the `lampserver` image. The first time you run the server in your directory, a MySQL data folder will be created inside your web directory under `./mysql` (you can change this if you want changing `-v :/var/lib/mysql`). A password for the `admin` user of MySQL is shown the first time. Your server is available at: http://localhost (if you want to use another port of your host machine, change `-p "80:80"` by `-p ":80"`) # Using MySQL 1. You can use PHPMyAdmin by going to http://localhost/phpmyadmin. You have to login with the `admin` user. 2. Alternatively, you can use the MySQL client for a running instance by issuing: ``` docker exec -it lampserver-1 mysql -uroot ``` # Backup a database You can get an SQL dump of a given database in your running instance by issuing: ``` docker exec -it lampserver-1 mysqldump -uroot [yourdatabasename] > db.sql ```