DEV Community

Cover image for How to install WordPress locally on Mac simply with Docker Compose file
Stan ku2ck4
Stan ku2ck4

Posted on • Updated on

How to install WordPress locally on Mac simply with Docker Compose file

Common Practice

There is a common practice on how to setup WordPress development locally. Mostly used are XAMPP and WAMP 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

Download Mac stable installation on official Docker hub domain here:

Download Docker Desktop

Run installation from the dmg file you have downloaded.

Alt Text

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 Desktop, create directory wpwebsite and enter into it using these commands one by one.

cd Desktop
mkdir wpwebsite
cd wpwebsite
Enter fullscreen mode Exit fullscreen mode

Save this docker-compose.yml you will find hereunder file into wpwebsite 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.


Running WordPress Docker Container

Now type into terminal this simple command.

docker-compose up
Enter fullscreen mode Exit fullscreen mode

Login Into WordPress And Install

You are ready to go through WordPress installation on your local machine. Go into the browser and type this URL.

Enter fullscreen mode Exit fullscreen mode

Alt Text

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

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

Alt Text

Login Into Wordpress CMS

When you want to access your local WordPress installation next time just type wp-login.php after localhost:2000, so whole url to start installation will be like this.

Enter fullscreen mode Exit fullscreen mode

And yeah, don't forget to copy some theme into wpwebsite/wp-content/themes 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 or share if you think others might be interested too.

Thanks to Isaac Ibbott for the cover image from Unsplash.

Discussion (0)