Skip to content

Instantly share code, notes, and snippets.

@mattbell87
Created October 5, 2019 01:05
Show Gist options
  • Save mattbell87/789af89af440d73e3a6120deb3f6e94f to your computer and use it in GitHub Desktop.
Save mattbell87/789af89af440d73e3a6120deb3f6e94f to your computer and use it in GitHub Desktop.
Wordpress with Docker Compose

Here's how you can get a wordpress instance running in seconds with Docker and Docker-Compose.

Requirements

  • Docker
  • Docker Compose

Instructions

  1. Create a folder and copy in docker-compose.yml
  2. Open a terminal and change directory to your new folder
  3. Inside that folder create a src folder (eg mkdir src)
  4. Run docker-compose up

Now open up http://localhost:8100

Tips

  • When I ran this on my Raspberry Pi I discovered that mysql doesnt run on 32bit ARM. If you're running on a Raspberry Pi and you have problems try changing the image to jsurf/rpi-mariadb.
version: '3'
services:
db:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: rootpasswordgoeshere
MYSQL_DATABASE: dbnamegoeshere
MYSQL_USER: dbusergoeshere
MYSQL_PASSWORD: dbpasswordgoeshere
web:
image: wordpress
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: dbusergoeshere
WORDPRESS_DB_PASSWORD: dbpasswordgoeshere
WORDPRESS_DB_NAME: dbnamegoeshere
depends_on:
- db
volumes:
- ./themes/:/var/www/html/wp-content/themes/
- ./plugins/:/var/www/html/wp-content/plugins/
- wpuploads:/var/www/html/wp-content/uploads/
ports:
- "8100:80"
volumes:
db:
wpuploads:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment