Quick and simple Local WordPress Setup for Lazy Developers

Quick and simple WordPress Setup for Lazy Developers

I needed a fast way to set up WordPress locally. I tried various methods, but they were either too complex or didn't work. So, I created a simple, lazy solution.

This is by no way secure, but it runs on the first try 😁

The code is in this GitHub repository. Feel free to use it.


Set up a local WordPress development environment easily with Docker Compose using this repository. One command sets up WordPress with WP-CLI, MariaDB, and PHPMyAdmin, plus autogenerated aliases for quick management. A second command sources these aliases. Perfect for quick, lazy local development. Not secure for production use.

Languages: Shell

  • ⭐ Stars: 0
  • Forks: 0
  • 👁 Watchers: 1
  • ❗ Open Issues: 0

How It Works

This setup revolves around 4 files:

1 docker-compose.yml:

This file:

  • Uses the latest official containers for WordPress, MariaDB, PHPMyAdmin, and WP-CLI.
  • Sets up a wordpress database with user and password root.
  • Launches a WordPress instance linked to the database.

2 setup.sh:

This script:

  • Detects whether you have docker-compose or docker compose and uses the correct one.
  • Sets your UID and GID in a .env file.
  • Generates an alias file for quick commands.

3 start.sh:

This script:

  • Creates the WordPress directory.
  • Sets permissions to 777 (yes, it's insecure).
  • Starts Docker Compose.

4 alias.sh:

Autogenerated by setup.sh or start.sh. Source it to get these aliases:

  • dc: Docker Compose commands.
  • wpcli: WP-CLI commands.
  • wpbackup: Backs up the database to ./backups.
  • wpdown: Backs up and then stops and removes containers and volumes.

How to Use

First you need to clone the repository:

git clone https://github.com/dacog/lazy-docker-compose-wordpress-setup.git
cd lazy-docker-compose-wordpress-setup

Run these commands to get started:

chmod +x setup.sh
chmod +x start.sh
source alias.sh

Now you are good to go. You will see a new folder wordpress is created in the path you were in.

Now you can:

  • Check http://localhost:8000 for the WordPress site
  • Check http://localhost:8080 for PHPMyAdmin. User and password is root

You receive this information also when you run start.sh.

Using the Aliases

alias dc

  • Bring up the services:
dc up -d
  • Stop the services:
dc down
  • Stop and remove volumes:
dc down -v
  • View the status of the services:
dc ps

alias wpcli

Run WP-CLI as root (it includes --allow-root):

  • Check WordPress version:
wpcli core version
  • Install a plugin:
wpcli plugin install hello-dolly --activate
  • Update WordPress core:
wpcli core update
  • Create a new post:
wpcli post create --post_title='My New Post' --post_content='This is the content of the post.' --post_status=publish


Back up the database to ./backups:



Back up the database and files, then stop and remove everything:



Here are some other methods to consider:

  1. Local by Flywheel: User-friendly local WordPress setup with advanced features. To be fair, I completely forgot about this when I was trying to get WordPress to run locally. This is way more powerful, but you need many clicks... and you need to fill a form to download it.
  2. DevKinsta: Offers local development with easy deployment to Kinsta hosting. I haven't tried this one.


Comments powered by Disqus