Posted In WordPress

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:

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.

Give it a bit to get everything setup then navigate to 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 ...

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. :) is proudly hosted by DigitalOcean

About these ads
  • I’m getting this error

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

    Post http:///var/run/docker.sock/v1.19/images/create?fromImage=tlongren%2Fdocker-wordpress-nginx-ssh%3Alatest: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?

    • Running some Ubuntu variant by chance?

      Try this in a terminal:
      sudo service docker start

      • I’m on latest OSX trying in terminal

        • 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.

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

            But other commands not working

          • 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

      • ❯ sudo service docker start


        sudo: service: command not found