Are you using Windows 11 and want to install WordPress for testing or development? No need to install XAMPP, no need to configure a complex server — just use Docker. It’s simple, easy to follow, and doesn’t require any programming knowledge.
Requirements:
- Docker Desktop installed and running on Windows 11
(Guide: https://itsmeit.co/how-to-install-docker-desktop-windows-11/) - Any text editor, such as Sublime Text or Notepad.
Open Docker Desktop and make sure it’s working, or run the docker info
command from PowerShell.
Step 1: Create a Project Folder
Search for and open PowerShell, then run the command:
mkdir wordpress-docker
This command creates a folder named wordpress-docker
at the pathC:\Users\<your_username>\wordpress-docker
to store the WordPress configuration files. You can create this folder anywhere — just make sure it’s easy to locate.
Move into the folder you just created:
cd wordpress-docker
Step 2: Create the docker-compose.yml
File
You can use any text editor you prefer — Notepad, VS Code, Sublime Text, etc.
Since I’m using PowerShell, I’ll use Notepad to create the file:
notepad docker-compose.yml
This will open Notepad and ask if you want to create a new file. Click OK and paste in the following content:
services:
wp_itsmeit:
image: wordpress:latest
ports:
- "8000:80"
environment:
WORDPRESS_DB_HOST: wordpress_db
WORDPRESS_DB_USER: db_user
WORDPRESS_DB_PASSWORD: db_password
WORDPRESS_DB_NAME: db_name
volumes:
- wordpress_data:/var/www/html
depends_on:
- wordpress_db
wordpress_db:
image: mariadb:10.5
environment:
MYSQL_DATABASE: db_name
MYSQL_USER: db_user
MYSQL_PASSWORD: db_password
MYSQL_ROOT_PASSWORD: root_password
volumes:
- db_data:/var/lib/mysql
volumes:
wordpress_data:
db_data:
Explanation:
wp_itsmeit
: Main container running WordPress (you can name it anything).wordpress:latest
: Pulls the latest WordPress version, or specify a version likewordpress:<version>
.wordpress_db
: Name of the MariaDB service container. It also acts as the hostname WordPress will use to connect to the database. You can rename this as long as it’s consistent throughout the config.volumes
: Ensures data is stored even if containers are stopped or deleted./var/www/html
: Path inside the container that holds WordPress source code.wordpress_data
: Docker volume storing WordPress data.image: mariadb:10.5
: Uses MariaDB v10.5 — stable and well-supported. You can also use MySQL or other versions likemariadb:latest
,mysql:latest
, ormysql:5.7
.db_data:/var/lib/mysql
: Mounts the database data to a persistent volume.MYSQL_ROOT_PASSWORD
: Required by MySQL/MariaDB, even if not strictly needed by you. Just set it asroot_password
.
Step 3: Run WordPress Using Docker
In CMD, within the wordpress-docker
folder (which now contains docker-compose.yml
), run:
docker compose up -d
Docker will automatically:
- Download the WordPress and MySQL images
- Create and start two containers
- Connect WordPress to MariaDB using the environment variables defined in the
docker-compose.yml
file, over a network Docker Compose creates automatically.

Step 4: Access the WordPress Setup Page
Open your browser and go to:
http://localhost:8000
You’ll see the WordPress installation screen. Select your language and follow the basic setup instructions like:
- Site title
- Admin username
- Login password
This step is simple — just follow the on-screen instructions. If you need help, refer to our article on how to set up a new WordPress site from step 4.
👉 After installation, you can view logs, source files, container status, etc., using the left menu in the Docker Desktop app (Volumes, Images, Containers, etc.).

Or run:
docker ps -a
Example output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d295b55d89dc wordpress:latest "docker-entrypoint.s…" 3 hours ago Up 3 hours 0.0.0.0:8000->80/tcp, [::]:8000->80/tcp wordpress-docker-wp_itsmeit-1
f7318e1caae2 mariadb:10.5 "docker-entrypoint.s…" 3 hours ago Up 3 hours 3306/tcp wordpress-docker-wordpress_db-1
Troubleshooting WordPress Installation on Docker
For unclear or vague errors, check logs in Docker Desktop or use the following commands to help identify issues:
docker compose logs
or
docker logs <container_name>
Tip: When faced with confusing errors, I usually copy the exact error message and paste it into ChatGPT or ClaudeAI. It often saves me a lot of time.
1. Error Establishing a Database Connection
Cause: Incorrect database configuration in docker-compose.yml
.
Make sure you’ve set the correct values for:
- Database name
- Username
- Password
Also, if you’ve previously run a test setup and forgot to remove old containers, or renamed a container incorrectly, it could conflict with the new setup.
Fix it with:
docker compose down -v
docker volume prune
2. Docker is stopped or not running
Error message example:
unable to get image 'wordpress:latest': error during connect: Get "http://%2F%2F.%2Fpipe%2FdockerDesktopLinuxEngine/v1.51/images/wordpress:latest/json": open //./pipe/dockerDesktopLinuxEngine: The system cannot find the file specified.
→ Just restart Docker Desktop on your machine.
Running WordPress with Docker on Windows 11 is incredibly simple and powerful. It’s a great way to create a development, learning, or demo environment quickly — without messing with your main OS.
Docker Management Commands
Check containers:
docker ps -a
Stop containers:
docker compose down
Remove containers and volumes:
docker compose down -v
Remove image:
docker image rm <image_id_or_name>
Access a running container:
docker exec -it <container> bash
Delete a container:
docker rm <container_name_or_id>
Remove an image:
docker image rm <container>
Delete a volume:
docker volume rm <volume_name>
List all volumes:
docker volume ls
Finally, if you need to back up or restore data, check out the article: How to Backup WordPress Data in Docker