Use Docker for Fast WordPress Development Environments

A Dockerfile That Provides Quick WordPress Development Environments

Back in May of this year I started playing around with Docker quite a bit. Took me a bit to wrap my brain around everything Docker can do, wish I had read this article from Adam Ierymenko before starting.

Anyway, Docker describes itself as such:

Docker is an open platform for building, shipping and running distributed applications. It gives programmers, development teams and operations engineers the common toolbox they need to take advantage of the distributed and networked nature of modern applications.

I’m not using Docker to it’s fullest extent, not even close. I mostly use it for setting up quick WordPress development environments for building client sites or just to do some testing.

I came across an outdated Dockerfile that had exactly what I needed but lacked the ability to SSH to the Docker container. I forked it on GitHub and added some modifications (like SSH).

It’s on the Docker Hub Registry, making it super easy to use. There’s a few items on the to-do list, but the one I want to take care of first is adding support for Docker Compose, which will make installation even easier.

To get started with this Docker image, you just need to have Docker installed and then run the following command:

sudo docker pull tlongren/docker-wordpress-nginx-ssh:latest

Once you’ve got the Docker image pulled, fire up a new container like with the command below. It will create a new Docker container named project-name.

sudo docker run -p 80:80 -p 2222:22 --name project-name -d tlongren/docker-wordpress-nginx-ssh:latest

Give it a bit to get everything setup then navigate to http://127.0.0.1:80 in your browser to access your new WordPress install.

For more information I suggest checking out the readme. Every time that I push commits to GitHub, a new build of the Docker image will automatically be built as I’ve got it setup as an automated build repository at the Docker Hub Registry. Pretty nifty.

So, I’m relatively new to Docker, if you’re a pro and see something I should be doing differently, please let me know. Any advice on setting up Docker Compose for this project would be great, too (if I’m not mistaken, it just involved linking multiple containers together).

Do you use Docker?

View Results

Loading ... Loading ...
8+

Well, now what?

Work with Me

I'm available for hire and always taking new clients, big and small. Got a project or an idea you'd like to discuss? Startup plan but no developer to make it happen? Just get in touch, I'd love to see if I can help you out!

Leave some Feedback

Got a question or some updated information releavant to this post? Please, leave a comment! The comments are a great way to get help, I read them all and reply to nearly every comment. Let's talk. 😀

Longren.io is proudly hosted by DigitalOcean

DigitalOcean

7 thoughts on “Use Docker for Fast WordPress Development Environments

        1. Ok, no problem. Can you see if docker is running?

          Try this in a terminal:
          docker ps -a

          If you see the same TLS error after running that command, the docker service probably isn’t running.

          Start it, however that’s done in osx, and try again.

          Let me know how it goes.

          0
          1. Docker is installed because when I type docker and enter it shows long list of docker commands.

            But other commands not working

            0
          2. Right, Docker is installed, but the Docker service isn’t running.

            Try this in your terminal:
            sudo docker -d

            Open a new terminal tab and then try running:
            docker ps -a

            0

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.