GitHub Repository: git@github.com:parkwoo/wordpress-docker-template.git
This repository is a template for easily setting up a WordPress development environment using Docker Compose. It provides a complete development environment including MySQL database and WordPress containers.
git clone git@github.com:parkwoo/wordpress-docker-template.git
cd wordpress-docker-templateIf you encounter SSH authentication errors: Check your GitHub SSH authentication settings. Use the following commands to check your SSH keys:
# Check for existing SSH keys
ls -al ~/.ssh
# Generate a new SSH key (if needed)
ssh-keygen -t ed25519 -C "your_email@example.com"
# Start the SSH agent and add your key
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
# Register your public key with GitHub
cat ~/.ssh/id_ed25519.pubAlternatively, you can clone using HTTPS:
git clone https://github.com/parkwoo/wordpress-docker-template.gitEdit the .env file to set environment variables:
# Copy the example env file (or edit if it exists)
cp .env.example .envMain environment variables:
MYSQL_ROOT_PASSWORD: MySQL root passwordMYSQL_DATABASE: Database name for WordPressMYSQL_USER: Database user for WordPressMYSQL_PASSWORD: Database password for WordPressEXPOSE_PORT: Public port for WordPress (default: 8080)
Create the necessary directories:
mkdir -p mysql/data mysql/conf
mkdir -p wordpress/themes wordpress/plugins wordpress/uploads# Start the containers
docker-compose up -d
# Check container status
docker-compose ps
# View logs
docker-compose logs -f- mysql: MySQL 8.0 database
- wordpress: Latest WordPress
./mysql/data→ MySQL data persistence./mysql/conf/custom.cnf→ MySQL configuration file./wordpress/themes→ WordPress themes./wordpress/plugins→ WordPress plugins./wordpress/uploads→ Media uploads
- Uses Docker's default network
- Containers can communicate using service names
- Access
http://localhost:8080in your browser - Follow the WordPress installation wizard
- Database information:
- Database Name:
wordpress(or the value set in .env) - Username:
wordpress(or the value set in .env) - Password: The value of
MYSQL_PASSWORDin your .env file - Database Host:
mysql - Table Prefix:
wp_(default)
- Database Name:
# Place your theme in the themes directory
cp -r your-theme/ wordpress/themes/# Place your plugin in the plugins directory
cp -r your-plugin/ wordpress/plugins/# Connect to the MySQL container
docker-compose exec mysql mysql -u root -p# Stop containers
docker-compose down
# Restart containers
docker-compose restart
# Rebuild images
docker-compose up -d --buildChange the EXPOSE_PORT value in your .env file to use a different port.
On Linux/Mac:
sudo chown -R 1000:1000 mysql/data wordpress/Wait until the containers are fully started (may take several tens of seconds).
Create or edit mysql/conf/custom.cnf to customize MySQL settings.
Add environment variables to the wordpress service in docker-compose.yml.
This template is provided under the MIT License. See the LICENSE file in the repository for details.
Please report bugs or request features via GitHub Issues.