Docker-NGINX-PHP-MySQL-PhpMyadmin
Docker NGINX PHP MySQL PhpMyadmin
Easy PHP MySQL development with Docker and Docker Compose.
With this project you can quickly run the following:
Contents:
Requirements
Make sure you have the latest versions of Docker and Docker Compose installed on your machine.
Clone this repository or copy the files from this repository into a new folder. In the docker-compose.yml file you may change the IP address (in case you run multiple containers) or the database from MySQL to MariaDB.
Make sure to add your user to the
group when using Linux.
Configuration
Edit the
file to change the default IP address, MySQL root password and Database name.
Installation
Open a terminal and
to the folder in which
is saved and run:
docker-compose up
This creates two new folders next to your
file.
– used to store and restore database dumps and initial databse for importdata
– the location of your php application filesweb
The containers are now built and running. You should be able to access the WordPress installation with the configured IP in the browser address. By default it is
.
For convenience you may add a new entry into your hosts file.
Usage
Starting containers
You can start the containers with the
command in daemon mode (by adding
as an argument) or by using the
command:
docker-compose start
Stopping containers
docker-compose stop
Removing containers
To stop and remove all the containers use the
command:
docker-compose down
Use
if you need to remove the database volume which is used to persist the database:
docker-compose down -v
Project from existing source
Copy the
file into a new directory. In the directory you create two folders:
– here you add the database dump or paste to init.sqldata
– here you copy your existing php project filesweb
You can now use the
command:
docker-compose up
This will create the containers and populate the database with the given dump.
Creating database dumps
./export.sh
phpMyAdmin
You can also visit
to access phpMyAdmin after starting the containers.
The default username is
, and the password is the same as supplied in the
file.