This guide provides step-by-step instructions for installing a vanilla (clean) instance of WordPress using WP CLI and running it via Docker.
Before proceeding with the installation, ensure that the following requirements are met:
- Open your terminal.
- Navigate to the directory where you want to install WordPress.
- Run the following command to download the latest version of WordPress:
wp core download --path=wordpress
- Navigate into the WordPress directory:
cd wordpress
-
Create a
docker-compose.yml
file in your project directory with the following content:version: '3' services: wordpress: image: wordpress:latest ports: - "8000:80" environment: WORDPRESS_DB_HOST: db WORDPRESS_DB_USER: your_database_user WORDPRESS_DB_PASSWORD: your_database_password WORDPRESS_DB_NAME: your_database_name volumes: - ./wordpress:/var/www/html db: image: mysql:5.7 environment: MYSQL_DATABASE: your_database_name MYSQL_USER: your_database_user MYSQL_PASSWORD: your_database_password MYSQL_ROOT_PASSWORD: rootpass volumes: - ./mysql:/var/lib/mysql
-
Run the following command to start the Docker containers:
docker-compose up -d
-
Once the containers are up and running, you can access your WordPress site by visiting
http://localhost:8000
in your web browser.
That's it! Enjoy portably development your next WordPress website on any machine! 🥳🚀