{"id":351,"date":"2020-01-06T09:00:00","date_gmt":"2020-01-06T09:00:00","guid":{"rendered":"http:\/\/yer.ac\/blog\/?p=351"},"modified":"2020-06-17T14:20:21","modified_gmt":"2020-06-17T14:20:21","slug":"using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3","status":"publish","type":"post","link":"https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\/","title":{"rendered":"Using Docker Containers for easy local WordPress development\ud83d\udc33"},"content":{"rendered":"\n<p>This will cover off setting up a Docker container for local WordPress development &amp; mounting the container folder for easier development.<\/p>\n\n\n\n<p class=\"has-text-color has-vivid-red-color\"><strong>NOTE: Updated to note possible performance issue in Docker using Windows Containers and mounted volumes. See the end of this post.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-circle-mask\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"648\" height=\"465\" data-attachment-id=\"355\" data-permalink=\"https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\/image-1-6\/\" data-orig-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2020\/01\/image-1.png?fit=648%2C465&amp;ssl=1\" data-orig-size=\"648,465\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2020\/01\/image-1.png?fit=648%2C465&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2020\/01\/image-1.png?resize=648%2C465\" alt=\"Containers, one with a wordpress logo\" class=\"wp-image-355\" srcset=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2020\/01\/image-1.png?w=648&amp;ssl=1 648w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2020\/01\/image-1.png?resize=300%2C215&amp;ssl=1 300w\" sizes=\"auto, (max-width: 648px) 100vw, 648px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"why-do-this\">Why do this?<\/h2>\n\n\n\n<p>Typically when doing any kind of WordPress work (Which is <em>exceptionally<\/em> rare for me), I would spin up a new WP instance on my host, or use something like a local LAMP\/XAMP server.<\/p>\n\n\n\n<p>Whilst this works, leveraging things like Docker mean almost zero configuration and more time developing. Better still, these then become throwaway environments!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"requirements\">Requirements<\/h2>\n\n\n\n<p>The only requirement for this is the installation of Docker (<a href=\"https:\/\/www.docker.com\/\">https:\/\/www.docker.com<\/a>)<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"creating-the-wordpress-instance\">Creating the WordPress instance<\/h2>\n\n\n\n<p>Firstly, create the folder where the configuration will live, for example <code>C:\\Docker\\Wordpress<\/code> In this folder we need to make a file named <code>docker-compose.yml<\/code>. This will be the YAML file detailing our wordpress installation &#8211; such as login information and MySQL setup.<\/p>\n\n\n\n<p>In this file, copy and paste the content below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>version: '3.1'\nservices:\n  wordpress:\n    image: wordpress\n    restart: always\n    ports:\n      - 1234:80\n    environment:\n      WORDPRESS_DB_HOST: db\n      WORDPRESS_DB_USER: exampleuser\n      WORDPRESS_DB_PASSWORD: examplepass\n      WORDPRESS_DB_NAME: exampledb\n  db:\n    image: mysql:5.7\n    restart: always\n    environment:\n      MYSQL_DATABASE: exampledb\n      MYSQL_USER: exampleuser\n      MYSQL_PASSWORD: examplepass\n      MYSQL_RANDOM_ROOT_PASSWORD: '1'\n<\/code><\/pre>\n\n\n\n<p>This will tell Docker that we need to use the image name &#8220;WordPress&#8221; from the Docker Hub (<a href=\"https:\/\/hub.docker.com\/_\/wordpress\">https:\/\/hub.docker.com\/_\/wordpress<\/a>), forward port 80 of the container (Which will be the exposed website) to port number 1234 of the parent host. This means going to http:\/\/localhost:1234 would go to port 80 of the docker container.<\/p>\n\n\n\n<p>Finally to use MySQL v5.7 as our database. You shouldn&#8217;t need to change this information, but if you do, make sure that the Database information in the <code>wordpress<\/code> section matches the information in the <code>db<\/code> section.<\/p>\n\n\n\n<p>Once this file is saved, we can run <code>docker-compose up -d<\/code> whilst in the same directory. This will take the YAML file, download any images that are not already on the local system and then set WordPress and MySQL up based on the YAML.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Note:<\/strong>: If you get the error <code>no matching manifest for windows\/amd64 in the manifest list entries<\/code> when running this command, and you are on Windows 10, you will need to enable &#8220;Experimental Mode&#8221; in your Docker installation. To do this, right-click on Docker in the system tray and go to settings, checking the box named &#8220;Experimental mode&#8221;.<\/p><\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Note:<\/strong>: If you get an error like <code>ERROR: for wordpress_db_1 Cannot create container for service db:<\/code>, this is usually caused by there being a conflict in ports. Try changing the external port (in this example &#8220;1234&#8221; for something else)<\/p><\/blockquote>\n\n\n\n<p>We can confirm if the docker container is running by running <code>docker ps<\/code> to list all running containers, or by going to http:\/\/localhost:1234 (The port will be whatever you set it to in the YAML)<\/p>\n\n\n\n<p>From here you can follow the standard WordPress installation steps.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"stopping-and-starting-instances\">Stopping and starting instances<\/h2>\n\n\n\n<p>You can stop and start instances by doing the following:<\/p>\n\n\n\n<p><code>docker-compose stop<\/code> and <code>docker-compose up -d<\/code>. Stop may take a little while.<\/p>\n\n\n\n<p>Note that these commands (in this syntax) have to be ran at the same level as the YAML file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"working-with-the-instance\">Working with the instance<\/h2>\n\n\n\n<p>If you just wanted to play with WordPress this would be enough, but what if you wanted to copy files to the instance, or edit files?<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"option-1-ssh-ftp\">Option 1: SSH\/ FTP<\/h3>\n\n\n\n<p>Although not personally a fan of this method, we could SSH to the container with a tool like PuTTY, see this guide: <a href=\"https:\/\/phase2.github.io\/devtools\/common-tasks\/ssh-into-a-container\/\">https:\/\/phase2.github.io\/devtools\/common-tasks\/ssh-into-a-container\/<\/a> We could also configure the container to have an FTP server. This won&#8217;t be covered as I believe the next option to be better.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"option-2-mount-a-windows-folder\">Option 2: Mount a windows folder<\/h3>\n\n\n\n<p>This option will mount a specific folder within the Docker container to a folder on your own system.<\/p>\n\n\n\n<p>Before continuing, we need to make sure that the container is currently stopped (<code>docker-compose stop<\/code>)<\/p>\n\n\n\n<p>We will make a change to the YAML file so that we add a <code>volumes<\/code> option, as shown below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>version: '3.1'\n\nservices:\n\n  wordpress:\n    image: wordpress\n    restart: always\n    ports:\n      - 1234:80\n    environment:\n      WORDPRESS_DB_HOST: db\n      WORDPRESS_DB_USER: exampleuser\n      WORDPRESS_DB_PASSWORD: examplepass\n      WORDPRESS_DB_NAME: exampledb\n    volumes: \n    - \"C:\/Docker\/Wordpress\/Mounted:\/var\/www\/html\"\n\n  db:\n    image: mysql:5.7\n    restart: always\n    environment:\n      MYSQL_DATABASE: exampledb\n      MYSQL_USER: exampleuser\n      MYSQL_PASSWORD: examplepass\n      MYSQL_RANDOM_ROOT_PASSWORD: '1'\n<\/code><\/pre>\n\n\n\n<p>As we can see, the <code>volumes<\/code> setting contains a string which is made up of 2 parts, seperated by a colon <code>:<\/code>. These are:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>C:\/Docker\/Wordpress\/Mounted   &#8211; This is the local path you want to mount the folder against.<\/li><li>\/var\/www\/html&#8221;            &#8211; This is the path within the container you want to mount.<\/li><\/ul>\n\n\n\n<p>Note that personally I like having the mount in the same directory as the configuration YAML for clarity, but it can live anywhere on your system.<\/p>\n\n\n\n<p>Saving this file and re-running the docker-compose command will now map the specified volume.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"footnote\">Footnote<\/h3>\n\n\n\n<p>I am a bit of a newbie when it comes to Docker, and I don&#8217;t use WordPress an awful lot so do take with a pinch of salt, and do let me know if this can be improved! <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">[UPDATE]: Performance Issues<\/h2>\n\n\n\n<p>It seems there are some well documented performance issues using volume mounts &#8211; especially on Mac and Windows. These caused the container to almost grind to a halt, even though there was hardly any CPU\/RAM\/IO use. There are many posts, including:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li> <a href=\"https:\/\/github.com\/docker\/for-win\/issues\/188\">https:\/\/github.com\/docker\/for-win\/issues\/188<\/a>  (Yet another long-open Github issue for Docker)<\/li><li> <a href=\"https:\/\/spin.atomicobject.com\/2017\/06\/20\/docker-mac-overcoming-slow-volumes\/\">https:\/\/spin.atomicobject.com\/2017\/06\/20\/docker-mac-overcoming-slow-volumes\/<\/a>  (Some alternate suggestions)<\/li><\/ul>\n\n\n\n<p>For me, after doing some digging I found that doing the following helped greatly:<\/p>\n\n\n\n<p><strong>Switch to using Linux Containers if you are on Windows<\/strong>. This is a bit of a pain as I require Windows Containers for something else I am doing, but it seems like the only workaround.<\/p>\n\n\n\n<p><strong>Use the :cached flag on the mounted volume<\/strong>. This is specifically for an issue reported on Mac, but appears to have been successful on Windows using Linux containers too. ( <a href=\"https:\/\/docs.docker.com\/compose\/compose-file\/#caching-options-for-volume-mounts-docker-desktop-for-mac\">https:\/\/docs.docker.com\/compose\/compose-file\/#caching-options-for-volume-mounts-docker-desktop-for-mac<\/a> )<\/p>\n\n\n\n<p>This is done by changing the mounted volume line to append the :cached flag.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>volumes: \n    - C:\/Docker\/Wordpress\/Mounted:\/var\/www\/html:cached<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Creating WordPress development environment using Docker containers.<\/p>\n","protected":false},"author":1,"featured_media":355,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6,7],"tags":[31,30],"class_list":["post-351","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development","category-devops","tag-docker","tag-wordpress"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Using Docker Containers for easy local WordPress development\ud83d\udc33 - yer.ac | Adventures of a developer, and other things.<\/title>\n<meta name=\"description\" content=\"Using a local Docker container for wordpress development\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development\ud83d\udc33\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Docker Containers for easy local WordPress development\ud83d\udc33 - yer.ac | Adventures of a developer, and other things.\" \/>\n<meta property=\"og:description\" content=\"Using a local Docker container for wordpress development\" \/>\n<meta property=\"og:url\" content=\"https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development\ud83d\udc33\/\" \/>\n<meta property=\"og:site_name\" content=\"yer.ac | Adventures of a developer, and other things.\" \/>\n<meta property=\"article:published_time\" content=\"2020-01-06T09:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-06-17T14:20:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i1.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2020\/01\/image-1.png?fit=648%2C465&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"648\" \/>\n\t<meta property=\"og:image:height\" content=\"465\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"yer.ac\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"yer.ac\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2020\\\/01\\\/06\\\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2020\\\/01\\\/06\\\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\\\/\"},\"author\":{\"name\":\"yer.ac\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#\\\/schema\\\/person\\\/4638b9d868c7d3747bd3bb01fbc8153d\"},\"headline\":\"Using Docker Containers for easy local WordPress development\ud83d\udc33\",\"datePublished\":\"2020-01-06T09:00:00+00:00\",\"dateModified\":\"2020-06-17T14:20:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2020\\\/01\\\/06\\\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\\\/\"},\"wordCount\":905,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#\\\/schema\\\/person\\\/4638b9d868c7d3747bd3bb01fbc8153d\"},\"image\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2020\\\/01\\\/06\\\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/yer.ac\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/image-1.png?fit=648%2C465&ssl=1\",\"keywords\":[\"docker\",\"wordpress\"],\"articleSection\":[\"Development\",\"DevOps\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/yer.ac\\\/blog\\\/2020\\\/01\\\/06\\\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2020\\\/01\\\/06\\\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\\\/\",\"url\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2020\\\/01\\\/06\\\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\\\/\",\"name\":\"Using Docker Containers for easy local WordPress development\ud83d\udc33 - yer.ac | Adventures of a developer, and other things.\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2020\\\/01\\\/06\\\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2020\\\/01\\\/06\\\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/yer.ac\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/image-1.png?fit=648%2C465&ssl=1\",\"datePublished\":\"2020-01-06T09:00:00+00:00\",\"dateModified\":\"2020-06-17T14:20:21+00:00\",\"description\":\"Using a local Docker container for wordpress development\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2020\\\/01\\\/06\\\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/yer.ac\\\/blog\\\/2020\\\/01\\\/06\\\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2020\\\/01\\\/06\\\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/yer.ac\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/image-1.png?fit=648%2C465&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/yer.ac\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/image-1.png?fit=648%2C465&ssl=1\",\"width\":648,\"height\":465},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2020\\\/01\\\/06\\\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/yer.ac\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using Docker Containers for easy local WordPress development\ud83d\udc33\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/yer.ac\\\/blog\\\/\",\"name\":\"yer.ac | Adventures of a developer, and other things.\",\"description\":\"Blog to keep track of things I am upto\",\"publisher\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#\\\/schema\\\/person\\\/4638b9d868c7d3747bd3bb01fbc8153d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/yer.ac\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#\\\/schema\\\/person\\\/4638b9d868c7d3747bd3bb01fbc8153d\",\"name\":\"yer.ac\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg\",\"caption\":\"yer.ac\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using Docker Containers for easy local WordPress development\ud83d\udc33 - yer.ac | Adventures of a developer, and other things.","description":"Using a local Docker container for wordpress development","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development\ud83d\udc33\/","og_locale":"en_US","og_type":"article","og_title":"Using Docker Containers for easy local WordPress development\ud83d\udc33 - yer.ac | Adventures of a developer, and other things.","og_description":"Using a local Docker container for wordpress development","og_url":"https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development\ud83d\udc33\/","og_site_name":"yer.ac | Adventures of a developer, and other things.","article_published_time":"2020-01-06T09:00:00+00:00","article_modified_time":"2020-06-17T14:20:21+00:00","og_image":[{"width":648,"height":465,"url":"https:\/\/i1.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2020\/01\/image-1.png?fit=648%2C465&ssl=1","type":"image\/png"}],"author":"yer.ac","twitter_card":"summary_large_image","twitter_misc":{"Written by":"yer.ac","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\/#article","isPartOf":{"@id":"https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\/"},"author":{"name":"yer.ac","@id":"https:\/\/yer.ac\/blog\/#\/schema\/person\/4638b9d868c7d3747bd3bb01fbc8153d"},"headline":"Using Docker Containers for easy local WordPress development\ud83d\udc33","datePublished":"2020-01-06T09:00:00+00:00","dateModified":"2020-06-17T14:20:21+00:00","mainEntityOfPage":{"@id":"https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\/"},"wordCount":905,"commentCount":0,"publisher":{"@id":"https:\/\/yer.ac\/blog\/#\/schema\/person\/4638b9d868c7d3747bd3bb01fbc8153d"},"image":{"@id":"https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2020\/01\/image-1.png?fit=648%2C465&ssl=1","keywords":["docker","wordpress"],"articleSection":["Development","DevOps"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\/","url":"https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\/","name":"Using Docker Containers for easy local WordPress development\ud83d\udc33 - yer.ac | Adventures of a developer, and other things.","isPartOf":{"@id":"https:\/\/yer.ac\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\/#primaryimage"},"image":{"@id":"https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2020\/01\/image-1.png?fit=648%2C465&ssl=1","datePublished":"2020-01-06T09:00:00+00:00","dateModified":"2020-06-17T14:20:21+00:00","description":"Using a local Docker container for wordpress development","breadcrumb":{"@id":"https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\/#primaryimage","url":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2020\/01\/image-1.png?fit=648%2C465&ssl=1","contentUrl":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2020\/01\/image-1.png?fit=648%2C465&ssl=1","width":648,"height":465},{"@type":"BreadcrumbList","@id":"https:\/\/yer.ac\/blog\/2020\/01\/06\/using-docker-containers-for-easy-local-wordpress-development%f0%9f%90%b3\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/yer.ac\/blog\/"},{"@type":"ListItem","position":2,"name":"Using Docker Containers for easy local WordPress development\ud83d\udc33"}]},{"@type":"WebSite","@id":"https:\/\/yer.ac\/blog\/#website","url":"https:\/\/yer.ac\/blog\/","name":"yer.ac | Adventures of a developer, and other things.","description":"Blog to keep track of things I am upto","publisher":{"@id":"https:\/\/yer.ac\/blog\/#\/schema\/person\/4638b9d868c7d3747bd3bb01fbc8153d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/yer.ac\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/yer.ac\/blog\/#\/schema\/person\/4638b9d868c7d3747bd3bb01fbc8153d","name":"yer.ac","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg","caption":"yer.ac"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2020\/01\/image-1.png?fit=648%2C465&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paP5IW-5F","jetpack-related-posts":[{"id":489,"url":"https:\/\/yer.ac\/blog\/2021\/04\/22\/using-podgrab-docker-to-backup-my-favorite-podcasts-in-this-case-on-a-qnap-nas\/","url_meta":{"origin":351,"position":0},"title":"Using PodGrab &#038; Docker to backup my favorite podcasts (In this case on a QNAP NAS)","author":"yer.ac","date":"April 22, 2021","format":false,"excerpt":"Whilst it's not a certainty that data will removed from the web, it does happen (See \/r\/datahoarder and \/r\/lostmedia). As I get all my podcasts through Spotify these days I have no control if they suddenly pull their account, or stop the show. There are also other use cases, like\u2026","rel":"","context":"In &quot;Home Networking&quot;","block_context":{"text":"Home Networking","link":"https:\/\/yer.ac\/blog\/category\/home-networking-2\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2021\/04\/image.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2021\/04\/image.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2021\/04\/image.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2021\/04\/image.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":514,"url":"https:\/\/yer.ac\/blog\/2021\/10\/06\/fixing-hostfxr-dll-could-not-be-found-within-windows-docker-container-net-installed-from-dotnet-install-ps1\/","url_meta":{"origin":351,"position":1},"title":"Fixing &#8220;hostfxr.dll could not be found&#8221; within Windows Docker container (.NET installed from dotnet-install.ps1)","author":"yer.ac","date":"October 6, 2021","format":false,"excerpt":"This is here mostly for my own reference for next time I need to fix this, but may be useful to someone else. Installing .NET (5, Core, etc.) via the Microsoft Supplied \"dotnet-install.ps1\"(https:\/\/docs.microsoft.com\/en-us\/dotnet\/core\/tools\/dotnet-install-script) installs the frameworks fine, but then running .net core code within that windows container would sometimes yield\u2026","rel":"","context":"In &quot;Docker&quot;","block_context":{"text":"Docker","link":"https:\/\/yer.ac\/blog\/category\/devops\/docker\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2021\/10\/image.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2021\/10\/image.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2021\/10\/image.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":576,"url":"https:\/\/yer.ac\/blog\/2025\/08\/18\/vibing-in-kiro-to-create-a-self-serve-portainer-wrapper\/","url_meta":{"origin":351,"position":2},"title":"Vibing in Kiro to create a self-serve Portainer wrapper.","author":"yer.ac","date":"August 18, 2025","format":false,"excerpt":"On a Friday afternoon with half an hour to spare, I tested Kiro, Amazon\u2019s new agentic IDE, against a real-world problem: giving my team a simple way to start and stop Docker services in Portainer. With nothing more than a rough prompt, a PowerShell script, and a few \u201cTrust command\u201d\u2026","rel":"","context":"In &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/yer.ac\/blog\/category\/development\/ai\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2025\/08\/Untitled-1.png?fit=1200%2C649&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2025\/08\/Untitled-1.png?fit=1200%2C649&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2025\/08\/Untitled-1.png?fit=1200%2C649&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2025\/08\/Untitled-1.png?fit=1200%2C649&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2025\/08\/Untitled-1.png?fit=1200%2C649&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":151,"url":"https:\/\/yer.ac\/blog\/2019\/05\/29\/remote-nlog-logging-with-azure-functions-part-two-persisting-data-into-azure-cosmos-db\/","url_meta":{"origin":351,"position":3},"title":"Remote NLOG logging with Azure Functions (Part two) &#8211; Persisting data into Azure Cosmos DB.","author":"yer.ac","date":"May 29, 2019","format":false,"excerpt":"Last time, I got a very basic C# Azure Function hooked up to accept a request from an NLOG web service target. This time, I will be attempting to persist(insert) the incoming log information into an Azure Cosmos database container, direct from my Azure Function in VS Code. Disclaimer: This\u2026","rel":"","context":"In &quot;Azure&quot;","block_context":{"text":"Azure","link":"https:\/\/yer.ac\/blog\/category\/development\/azure\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/05\/image-12.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/05\/image-12.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/05\/image-12.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/05\/image-12.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/05\/image-12.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":78,"url":"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/","url_meta":{"origin":351,"position":4},"title":"Debugging ES6 Mocha unit tests using VS Code","author":"yer.ac","date":"April 9, 2019","format":false,"excerpt":"The world of Mocha, VS Code and Node is still fairly new to me. Typically in the past all my JS unit tests have been debuggable in-browser using DevTools, but with Mocha this is not the case (As I am not deploying my spec files). I got Mocha to load\u2026","rel":"","context":"In &quot;Development&quot;","block_context":{"text":"Development","link":"https:\/\/yer.ac\/blog\/category\/development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":337,"url":"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/","url_meta":{"origin":351,"position":5},"title":"Identifying Nuget package references which are using relative paths across whole solution","author":"yer.ac","date":"November 20, 2019","format":false,"excerpt":"Keeping up with a recent binge upgrading projects, including upgrading all my projects in a solution to 4.8, I have been upgrading nuget packages. Whilst this is a relatively simple task, what irks me is that when you add or upgrade a nuget package in Visual Studio, it will often\u2026","rel":"","context":"In &quot;Development&quot;","block_context":{"text":"Development","link":"https:\/\/yer.ac\/blog\/category\/development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-2.png?fit=376%2C382&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/posts\/351","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/comments?post=351"}],"version-history":[{"count":7,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/posts\/351\/revisions"}],"predecessor-version":[{"id":427,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/posts\/351\/revisions\/427"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/media\/355"}],"wp:attachment":[{"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/media?parent=351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/categories?post=351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/tags?post=351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}