An Awesome Wordpress Locally With Wocker In A Minute

Joilson Cisne
Superela
Published in
2 min readJul 14, 2016

Improve, improve, improve… And improve fast. One of the basic concepts widely spread about software development is that a good development pipeline is indispensable for delivering good quality software in a fast pace.

Local development

Our first step of improvement was equalize the local development environment.

The goal was to create the same local dev environment to all developers as easy as possible. Since we are a very small team, we have a lot work to do and the fast we can setup a new member the better.

Another benefit is that everyone will be developing in the "same" environment. This avoids problems that surface due to different platform configurations and facilitates one to help another if real bug occurs.

What is Wocker?

Wocker is a local WordPress development environment. Since it’s based on Docker, it takes just 3 seconds to create every new installation of WordPress.

How we used it

These are the first steps as described in the section Get Started, I added the last step (because I didn’t want to use the default url http://wocker.dev):

1. Install Vagrant

http://www.vagrantup.com/

2. Install VirtualBox

https://www.virtualbox.org/

3. Install the vagrant-hostsupdater plugin.

$ vagrant plugin install vagrant-hostsupdater

4. Clone the Wocker Repository

$ git clone https://github.com/wckr/wocker.git && cd wocker

5. Start up Wocker

$ vagrant up

This could take a while on the first run as your local machine downloads the required files. Watch as the script ends, as an administrator or su password may be required. The first default container wocker will be running after the provision finishes successfully.

6. Visit following site in your browser

http://wocker.dev/

7. Change the site url

$ vagrant ssh
wocker ~ $ wocker wp option siteurl x.x.x.x

wocker ~ $ wocker wp option home x.x.x.x

In the code above, x.x.x.x is the IP address of my WP server (see the line below from the Vagrantfile).

config.vm.network :private_network, ip: "10.0.23.16"

Conclusion

It was pretty easy to setup our local development environment for our Wordpress project with Wocker. The Wordpress files are created inside a /data folder in the directory where Wocker was cloned, and they are shared with the running container. That means that each change in the files in the guest machine will be instantly reflected inside the running container.

Even though it was a easy installation, do not limit yourself by stopping here. Study more and understand how Wocker works under the hood. Also learn more about Vagrant and Docker.

Did you setup your local Wordpress in an easier way? Let me know in a comment below.

Special Thanks

I would like to thank Lars Hofvander for the support and English review.

--

--