- PostgreSQL database environment
- MySQL database environment
- Wordpress project on isolated environment
repository
├── postgres/
│ ├── docker-compose-postgres.yml
├── mysql/
│ ├── docker-compose-mysql.yml
├── wordpress-project/
│ ├── .env.example
│ ├── docker-compose-db-init.yml
│ ├── docker-compose-wordpress.yml
│ ├── docker-compose-override.yml
│ ├── dump.sql (for test purposes)
│ ├── Makefile
│ └── wp-config.php
└── README.md
- Run
docker compose -f docker-compose-postgres.yml
postgres
├── user: `admin`
├── password: `admin`
└── port: `5432`
- Run
docker compose -f docker-compose-mysql.yml
- Access phpMyAdmin on
localhost:8080
mysql
├── port: 3306
phpmyadmin
├── port: 8080
├── user: root
└── root_password: rootpassword
WordPress project uses Makerfile
to create and run the environment
- Run
make
to:- Create and import the database
- Remove the initiator container
- Create a isolated container based on
Dockerfile
- Call wordpress image if no
Dockerfile
is found - Mount/bind local code to docker container
- Use
host.docker.internal
asDB_HOST
to connect from project containers to the MySQL container on Windows/Mac. - Ensure consistent MySQL user permissions to isolate databases.
- Each project mounts its code locally for live updates.
- You can customize PHP/Apache versions per project if needed.
-
PostgreSQL environment (once):
docker compose -f docker-compose-postgres.yml up -d
-
MySQL environment (once):
docker compose -f docker-compose-mysql.yml up -d
-
For each WordPress project:
- Add your code and
.env
- Run the project with:
make
- Add your code and