Building a custom WordPress theme? Developing a plugin? No doubt you would need a local environment to develop and test your creation. But how do you go about it? Surely you can go with XAMPP (or WAMP), but have you ever felt the frustration of going through the installation of a PHP extension to XAMPP or the performance issues XAMPP brings when used locally? Here’s the solution for you – Docker.

In this post, we will guide you through the Docker quickstart for your local WordPress development environment.

Before Getting Started

What is Docker? Basically, it is a tool that lets you create, manage and run applications in virtual containers. The bright part of it is Docker packs the application, its config and all of its dependencies into just one container. That allows you to run the same container in different environments be it local, a staging server on the cloud hosting or even the production environment on your production server. (Still, we must add that running the production application (WP website in this case) in a Docker container is not recommended, but it is possible.)

What makes a Docker virtual container so fast to start and really lightweight is the fact that it only includes the application code isolated from the system it runs on. There’s no operating system (OS) included and it uses the underlying OS instead.

Where Do I Start?

Before starting the Docker environment setup you would need to download and install a couple of things:

The official Docker website has a pretty straightforward installation guide. Just select the OS you are using on your machine and follow the instructions.

Ok, Done. What’s Next?

Next, you need to create a new folder in your file system which will be the main folder for your Docker files. Create a folder and name it, for example, docker-wp.

Then enter that folder and create a file called  docker-compose.yml.  This will be your central Docker configuration file.

The thing we really like about Docker is Docker Hub — an official image library that lets you implement and use a variety of container images you can use in your work. Images we will be using for this example are an official WordPress image and MariaDB (database forked from MySQL).

Now we will need to add the configuration itself to our docker-compose.yml. Below is an example config  with comments describing each block.

version: '2'
  # Defines the Docker Compose version
services:
  # Services block defines which images Docker will run. In this case it is MariaDB image for MySQL and a WordPress image
  mysql:
    image: 'mariadb:latest'
    # Using the latest MariaDB image from the Docker Hub 
    
    environment:
      MYSQL_ROOT_PASSWORD: example_root_pass
      MYSQL_DATABASE: example_wpdbname
      MYSQL_USER: example_user 
      MYSQL_PASSWORD: example_password_db
      # MySQL variables: database, database username, database user password, and the MySQL root password.
    ports:
      - 3308:3306
	# Ports for our database
 
  wp-site:
    depends_on:
      - mysql
        # This line makes WordPress image to wait until MariaDB loads before starting itself
    image: wordpress:latest
	# Docker Hub image for WordPress
    environment: 
      WORDPRESS_DB_HOST: db:3306 
      WORDPRESS_DB_USER: example_user 
      WORDPRESS_DB_PASSWORD: example_password
      WORDPRESS_DB_NAME: example_wpdbname
      # Same with the variables here. These are the variables for WordPress container to work
    ports:
      - 80:80
      - 443:443
	# Opening both HTTPS and HTTP ports
    volumes:
      - ./wp-content:/var/www/html/wp-content
    links:
      - mysql
	# This line connects the WordPress image to the MariaDB image within our container

Starting the Container

Now that our Docker container is configured we can start it using a simple command in the CLI:

docker-compose up -d

This command will start the Docker container using Docker Composer tool and the standard docker-compose.yml file. In case you have a couple of different config YAML files with different settings you want to try out, your command would look something like this:

docker-compose -f docker-compose.dev.yml up -

Once your container is up and running go to http://localhost/ or http://127.0.0.1/ to finish your WordPress installation.

Once you are done with it voila! Your local development environment is ready to go and serve you in your work. 

So How Do I Access the Files and, Well, Develop?

Remember that WordPress container image we pulled in our YAML file? When we imported it, it had automatically created all the necessary files and folders for our WP environment, such as wp-content, wp-admin, and wp-includes. Now, you can simply navigate to your docker-wp and place all the other files there that you need for your project.

Conclusion

Docker is a powerful, easy-to-use and really handy tool that helps you streamline your development process. While switching between different solutions for the local development environment for the last couple of years we find this option to be one of the best.    

At Points Group, we make website development easy by partnering with you to manage all your website needs. Contact us today if you have questions about your website! 

Some ReadMores

Our Partners

partners
facebook marketing partner
google partner
shopify logo
hubspot partner program

Subscribe to Our Newsletter!

@ 2023 Points Group / All Right Reserved

This Privacy Policy governs the manner in which Points Group, LLC collects, uses, maintains and discloses information collected from users (each, a “User”) of the https://www.pointsgroup1.10web.me website (“Site”). This privacy policy applies to the Site and all products and services offered by Points Group, LLC.

PERSONAL IDENTIFICATION INFORMATION

We may collect personal identification information from Users in a variety of ways, including, but not limited to, when Users visit our site, subscribe to the newsletter, respond to a survey, fill out a form, and in connection with other activities, services, features or resources we make available on our Site. Users may visit our Site anonymously. We will collect personal identification information from Users only if they voluntarily submit such information to us. Users can always refuse to supply personal identification information, except that it may prevent them from engaging in certain Site related activities.

NON-PERSONAL IDENTIFICATION INFORMATION

We may collect non-personal identification information about Users whenever they interact with our Site. Non-personal identification information may include the browser name, the type of computer and technical information about User’s means of connection to our Site, such as the operating system and the Internet service providers utilized and other similar information.

WEB BROWSER COOKIES

Our Site may use “cookies” to enhance User experience. User’s web browser places cookies on their hard drive for record-keeping purposes and sometimes to track information about them. User may choose to set their web browser to refuse cookies, or to alert them when cookies are being sent. If they do so, note that some parts of the Site may not function properly.

HOW WE USE COLLECTED INFORMATION

Points Group, LLC may collect and use Users personal information for the following purposes:

  • To improve customer service
  • Information you provide helps us respond to your customer service requests and support needs more efficiently.
  • To personalize user experience
  • We may use information in the aggregate to understand how our Users as a group use the services and resources provided on our Site.
  • To improve our Site
  • We may use feedback you provide to improve our products and services.
  • To run a promotion, contest, survey or other Site feature
  • To send Users information they agreed to receive about topics we think will be of interest to them.
  • To send periodic emails
  • We may use the email address to respond to their inquiries, questions, and/or other requests. If User decides to opt-in to our mailing list, they will receive emails that may include company news, updates, related product or service information, etc. If at any time the User would like to unsubscribe from receiving future emails, we include detailed unsubscribe instructions at the bottom of each email.

HOW WE PROTECT YOUR INFORMATION

We adopt appropriate data collection, storage and processing practices and security measures to protect against unauthorized access, alteration, disclosure or destruction of your personal information, username, password, transaction information and data stored on our Site.

SHARING YOUR PERSONAL INFORMATION

We do not sell, trade, or rent User’s personal identification information to others. We may share generic aggregated demographic information not linked to any personal identification information regarding visitors and users with our business partners, trusted affiliates and advertisers for the purposes outlined above. We may use third party service providers to help us operate our business and the Site or administer activities on our behalf, such as sending out newsletters or surveys. We may share your information with these third parties for those limited purposes provided that you have given us your permission.

THIRD PARTY WEBSITES

Users may find advertising or other content on our Site that link to the sites and services of our partners, suppliers, advertisers, sponsors, licensors and other third parties. We do not control the content or links that appear on these sites and are not responsible for the practices employed by websites linked to or from our Site. In addition, these sites or services, including their content and links, may be constantly changing. These sites and services may have their own privacy policies and customer service policies. Browsing and interaction on any other website, including websites which have a link to our Site, is subject to that website’s own terms and policies.

CHANGES TO THIS PRIVACY POLICY

Points Group, LLC has the discretion to update this privacy policy at any time. When we do, we will revise the updated date at the bottom of this page. We encourage Users to frequently check this page for any changes to stay informed about how we are helping to protect the personal information we collect. You acknowledge and agree that it is your responsibility to review this privacy policy periodically and become aware of modifications.

YOUR ACCEPTANCE OF THESE TERMS

By using this Site, you signify your acceptance of this policy. If you do not agree to this policy, please do not use our Site. Your continued use of the Site following the posting of changes to this policy will be deemed your acceptance of those changes.

CONTACTING US

If you have any questions about this Privacy Policy, the practices of this site, or your dealings with this site, please contact us at:

Points Group, LLC

https://www.pointsgroup1.10web.me

150 Morristown Road, Suite 220

Bernardsville, NJ 07924

This document was last updated on July 24, 2014