How to install WordPress locally on Mac simply with Docker Compose file 🤘
Tags: wordpress, devops, showdev, webdev
Published: 2020-08-19 11:12:58

##Common Practice
There is a common practice on how to setup WordPress development locally. Mostly used are [XAMPP](https://www.apachefriends.org/index.html) and [WAMP](https://www.wampserver.com/en/) for this purpose or similar. How to install Wordpress without these? 

##Quickest and Fastest Way
Today I would like you to show for me the easiest and fastest way how to make WordPress work for you on your local machine in almost a few simple steps. We gonna use Docker hub and **it will take 10 minutes**.

##Download and Install
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/swdl8l52xuctzpn4kebq.png)

Download Mac stable installation on official Docker hub domain here:

👉 [Download Docker Desktop] (https://download.docker.com/mac/stable/Docker.dmg)

Run installation from the <code>dmg</code> file you have downloaded. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9rqktto9hhh0ggk5j4gc.png)

Approve access and privileged access that Docker Desktop will ask for.

##Copying WordPress Docker Image File
Create a directory for the website for example on Desktop, so go to <code>Desktop</code>, create directory <code>wpwebsite</code> and enter into it using these commands one by one.

```
cd Desktop
mkdir wpwebsite
cd wpwebsite
```
Save this <code>docker-compose.yml</code> you will find hereunder file into <code>wpwebsite</code> directory. It's an image for WordPress docker container installation that will set up all needed, like WordPress directory structure and MariaDB database as well.

[👉 docker-compose.yml](https://raw.githubusercontent.com/stankukucka/docker-compose-wordpress-image-mariadb/master/docker-compose.yml)

##Running WordPress Docker Container
Now type into terminal this simple command.

```
docker-compose up
```
##Login Into WordPress And Install
You are ready to go through WordPress installation on your local machine. Go into the browser and type this <code>URL</code>.

```
http://localhost:2000
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4q2t0ad4wjet3rhh3ml1.png)

##Docker Desktop Dashboard
Pass all this installation and now you are ready to login to your local WordPress installation. You can check it as well on Docker Desktop Dashboard clicking on a tiny icon on your top panel.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/06cu5oudexcg88o0cpk3.jpg)

And check it anytime how DB and website are running and stop or delete it anytime.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/yrecoa4fo38kyixuc4ck.png)

##Login Into Wordpress CMS
When you want to access your local WordPress installation next time just type <code>wp-login.php</code> after <code>localhost:2000</code>, so whole url to start installation will be like this.

```
http://localhost:2000/wp-login.php
```

And yeah, don't forget to copy some theme into <code>wpwebsite/wp-content/themes</code> to see something real in your browser, cos this standard installation doesn't have any.

##Enjoy Local WordPress Development 
Hope you enjoyed this little WordPress installation adventure and found it interesting and now you are ready to go with a local WordPress theme or plugin development.

If you have questions or enjoyed this article, please feel free to comment or [message me here](https://dev.to/connect/@stankukucka) or share if you think others might be interested too.

Thanks to [Isaac Ibbott](https://unsplash.com/@wanderingimagery?utm_source=unsplash&utm_medium=referral&utm_content=CreditCopyTextGratitude) for the cover image from Unsplash.