Common Practice
There is a common practice on how to setup WordPress development locally, most people use XAMPP and WAMP … but is there a better way, which saves you from doing all the XAMPP and WAMP configuration and unique urls? Why not use the power of containers to install a separate instance of WordPress for each development site? Create a site in 5 minutes!!
Quickest and Fastest Way to create WordPress on Docker
Today I would like you to show for me the easiest and fastest way how to make WordPress work for you on your local development machine in a few simple steps. We can use Docker hub and it will take less than 10 minutes.
Create a directory for your WordPress site and copy in the WordPress Docker Image File
Download Mac stable installation on official Docker hub domain here:
Download Docker Desktop
Adding WordPress to our docker install
Or Use the terminal to create folder:
mkdir wpwebsite
cd wpwebsite
It’s a file that contains all the docker ingredients needed to install all the items, like WordPress directory structure and mysql database as well.
docker-compose.yml
File contents:
version: '3' services: db: image: mysql:5.7 volumes: - db_data:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: somewordpress MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress wordpress: depends_on: - db image: wordpress:5.1.1-php7.3-apache ports: - "8000:80" restart: always environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress working_dir: /var/www/html volumes: - ./wp-content:/var/www/html/wp-content - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini volumes: db_data:
Running WordPress Docker Container
Once the file is moved into the directory open a terminal and run the file
Docker-compose up
Next steps we Login into WordPress And Install
Open a web browser and go through a standard WordPress install
http://localhost:8000
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.
And check it anytime how DB and website are running and stop or delete it anytime.
When you want to access your local WordPress installation next time just type wp-login.php after
localhost:8000, so whole URL to start installation will be like this:
http://localhost:8000/wp-login.php
Enjoy your Local WordPress Development
Your email address will not be published. Required fields are marked *
Comment *
Name *
Email *
Website
Save my name, email, and website in this browser for the next time I comment.
Post Comment
Δ