If you want to run WordPress locally, skip XAMPP/MAMP and use Docker Compose. Here’s a setup that works for migrations, plugin/theme dev, or testing.
docker compose CLI should work)Paste this as compose.yml in your project root:
services:
wordpress:
image: wordpress:6.5-php8.2-apache
container_name: wp_site
ports:
- "8080:80"
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_USER: wpuser
WORDPRESS_DB_PASSWORD: wppassword
WORDPRESS_TABLE_PREFIX: your_table_prefix_
WP_DEBUG: true
volumes:
- ./public_html:/var/www/html
depends_on:
- db
db:
image: mariadb:10.6
container_name: wp_db
restart: always
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: wordpress
MYSQL_USER: wpuser
MYSQL_PASSWORD: wppassword
volumes:
- db_data:/var/lib/mysql
volumes:
db_data:
Replace yourprefix_ with your table prefix (default is wp_).
Update passwords as needed.
public_htmlpublic_html from production hereYou can also drop your database export (database.sql) in the root directory for later.
docker compose up -d
This will:
– Start WordPress at http://localhost:8080
– Start MariaDB for your WP instance
Replace database.sql with your file name:
docker exec -i wp_db mysql -u wpuser -pwppassword wordpress < database.sql
If your imported DB tables use a custom prefix (not wp_), set WORDPRESS_TABLE_PREFIX in your compose file (as above).
Otherwise, WordPress will act like it’s a fresh install.
If you migrated from production, update all site URLs:
docker run --rm --network yourproject_default \
-v "$PWD/public_html:/var/www/html" \
-w /var/www/html \
-e WORDPRESS_DB_HOST=db \
-e WORDPRESS_DB_USER=wpuser \
-e WORDPRESS_DB_PASSWORD=wppassword \
-e WORDPRESS_DB_NAME=wordpress \
-e WORDPRESS_TABLE_PREFIX=yourprefix_ \
wordpress:cli \
php -d memory_limit=512M /usr/local/bin/wp search-replace 'https://yourproductiondomain.com' 'http://localhost:8080' --skip-columns=guid
Adjust network name, domain, and prefix as needed. Run the command twice, the first time as shown above and the second time remove the ‘http’ / ‘https’ from the url listed, since both forms exist in WordPress dbs.
Check our Website Repair service and our SEO Audit service
If your WP admin login doesn’t work after importing, reset the password with:
docker run --rm --network yourproject_default \
-v "$PWD/public_html:/var/www/html" \
-w /var/www/html \
-e WORDPRESS_DB_HOST=db \
-e WORDPRESS_DB_USER=wpuser \
-e WORDPRESS_DB_PASSWORD=wppassword \
-e WORDPRESS_DB_NAME=wordpress \
-e WORDPRESS_TABLE_PREFIX=yourprefix_ \
wordpress:cli \
php -d memory_limit=512M /usr/local/bin/wp user update youradmin --user_pass='yournewpass'
Site is up at http://localhost:8080.
Debug as needed using WP_DEBUG or by checking logs.
No magic, no plugins required. If you break it, just blow away containers and volumes and start over.
AI is everywhere right now - but most teams still struggle to turn AI into…
If you’ve been hearing about OpenClaw and wondering what it actually does, you’re not alone.…
In a competitive city like Atlanta, customers compare options before making a decision. They read…
Software as a Service companies operate on a subscription model. That changes how marketing should…
Search engines need helpful information to understand what your site is about. That is where…
The short answer is that inbound marketing costs can vary a lot. The final price…
This website uses cookies.