Skip to main content



In this 25 minute movie, I am going to clearly show you how to create and use a essential WordPress development setting designed with Docker and Docker Compose.

Comply with me on Twitter for a lot more net development guidelines, news, and tutorials:

You may master how to:

– Set up and set up Docker
– Generate a Docker Compose file to scaffold out containers
– Enable HTTPS and keep MySQL information persistent
– Use the wp-cli device with out getting to set up it regionally

– :00 Intro and Set up
– 2:50 Scaffolding Containers
– 6:10 Configuring Nginx
– 10:10 Installing WordPress
– 15:06 Incorporating HTTPS
– 19:00 Persistent MySQL Facts
– 20:58 Introducing wp-cli
– 24:42 Conclusion

Docker documentation about delegated volumes for MacOS:

29 Comments

  • If you'd like to see the full code along with some additional helper items, check out the GitHub repo here: https://github.com/aschmelyun/docker-compose-wordpress

  • Wonderful content!

    Please help us setting the Roots Stack Environment on Docker too! (Bedrock, Sage…)

  • Colman Byrne says:

    While WP will run fine , there are some missing modules , gd , imagick , bcmath, exif that can cause some issues with some plugins and themes .

    I would recommend a change to the php.dockerfile to include these , can be left out if you dont need them.

    RUN docker-php-ext-install mysqli pdo pdo_mysql bcmath exif && docker-php-ext-enable pdo_mysql bcmath exif

    RUN set -ex

    && apk add –no-cache –virtual .phpize-deps $PHPIZE_DEPS imagemagick-dev libtool

    && export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS"

    && pecl install imagick-3.4.3

    && docker-php-ext-enable imagick

    && apk add –no-cache –virtual .imagick-runtime-deps imagemagick

    && apk del .phpize-deps

    RUN apk add –no-cache libpng libpng-dev && docker-php-ext-install gd && apk del libpng-dev

    of course if you add them , rebuild with docker-compose up -d –build site

  • Colman Byrne says:

    running the docker-compose run –rm wp core download to install an new wordpress install works fine , but leaves the owner as root not wp, so you will have issues installing plugins ( requesting ftp credentials ) either chown -R wp:wp /var/www/html to correct on php container or add define('FS_METHOD','direct'); to your wp-config.php file

  • Amazing Tutorial. I have been using compose-file from others because I always ran into one problem or other. But because of your approach of letting things fail and fixing it, I not only ran wordpress, but also successfully ran laravel setup. Now I will try my hand on Laravel-Vue microservice setup because that is what my actual app is using. I am guessing I just need to create another service called node and try to match ports between them just like you did on fpm?

  • Great starter tutorial.
    I have trouble uploading larger files, either media or plugins. Any help here?

  • To Ca says:

    If one uses multiple servers, where one has db, other has cache and two others have the webapp itself, would it be smart to have docker only for development, and use some other way to handle the production servers? Or is there a good established way to do this with docker too, where development and deployment have each their own setup? And how would one run only one part of the app on one server?

    Kubernetes might solve the issue, but seems like an overkill for this problem.

  • Visualmodo says:

    Excellent WordPress guide!

  • You've got a new subscriber in me. Loving the Laravel + Docker tutorials. Cheers

  • PathOfDamn says:

    Sorry if this was answered before, but since I'm using windows and I DON'T want to use HyperV for Docker (I'm using VirtualBox for other things), and that I can't really use WSL2 at the moment (can't afford a restart, too many things running LOL), do you think it is recommended that I spin up a debian-testing vm, install docker engine in there, and then through VSCode's Remote Dev extension I develop things with docker in that vm?

    I mean, yea, I can just dual-boot, but I think I'm too swamped with work atm to reorganize my stuff. Sorry if this was a dumb question.

  • Tnt 1111 says:

    thank you very much can you do reverse proxy with docker

  • Nice! Your explanation is so helpful, cool and clear! Thanks… I needed this

  • superhelpful! thank youu amazing

  • Vineet Singh says:

    9:52 >> how did you get that wordpress installation page

  • blinkapec says:

    What's that sweet-sounding keyboard of yours? 😄

  • blinkapec says:

    Thanks for the non-trivial approach (not just "image: wordpress"), in my opinion it is more flexible and interesting, since teaches some additional details regarding dockerization in general.

  • Yuu Source says:

    Awesome! Can you include this version xDebug and phpunitest.. I would appreciate that.

  • This tutorial absolutely rocks. I followed the tutorial and used the same example URL, but now that I want to change it I can't (even though I changed it in the default.conf). Any tips how to fix it?

  • I add this line to my host file "127.0.0.1 wordpress-docker.test" but I get 403 forbidden when I go to wordpress-docker.test and I am not sure where the problem could be. Anybody else have this issue or know what the issue could be? Thanks.

  • Perhaps I'm missing something, but why is WordPress manually brought in like that (downloaded and just added)? Can't it be brought in and version controlled/updated in the same way that the other services were, in a composer-like way? I thought that was the whole point of all of this.

  • Kuqs says:

    for the people who get a 403 error:

    under the line:
    root /var/www/html;

    just put:
    index index.php index.html index.htm index.nginx-debian.html;

  • Sleep Theory says:

    This is how tutorial should be made. i wish i could like more.

  • if you're on windows & having troubles following the tutorial after 8:00
    You might need to update File Sharing configuration in your Docker for Windows app to include your work directory :"D

  • As of 5/11/2021, I can confirm this setup will not work on Windows 10, trying to build this same exact process. It fails to loading the WordPress install screen at 9:45. In fact, the browser does not even know what wordpress-docker.test is when typed into the browser while these containers are running with Docker Desktop.

  • Tony says:

    Amazing tutorial, thanks

  • Excellent walkthrough

  • pats salaets says:

    Fantastic tutorial thanks

  • The thing I came here for, and got at the end of the video was how to keep plugin installations in version control.
    The answer seem to be to add a wp-cli container and put the commands to run in a dockerfile. Then, each time you start the service, it will run the wp-cli commands and install the plugins.
    Dunno exactly how or if that's persisted in the db, but I'm guessing it's just persisted in the wp-plugins directory and not in the database.
    Will give it a try on my own installation tomorrow. Thanks for a great, educational video.
    Keep em up, you earned yourself a subscriber!

Leave a Reply