Sometimes you want to run a WordPress CLI command on your dev machine, and you just know running it with Docker would be easier than installing a PHP environment locally. But you also know that figuring out the correct Docker command line options to run is going to take forever!

Never fear, here’s an example you can copy/paste!

$ docker run --rm -u 1000:10 -it \
>   -v ~/dev/my-wp-plugin:/var/www/html/plugin \
>   wordpress:cli \
>   i18n make-pot plugin --domain=text-domain

This example happens to generate the pot file for the plugin being developed in ~/dev/my-wp-plugin.