Skip to content

Instantly share code, notes, and snippets.

@fieldoffice
Last active December 13, 2018 13:09
Show Gist options
  • Save fieldoffice/cf104269c9898412413ffe2002712a4c to your computer and use it in GitHub Desktop.
Save fieldoffice/cf104269c9898412413ffe2002712a4c to your computer and use it in GitHub Desktop.
Running WordPress using Docker
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
working_dir: /var/www/html
volumes:
- /Users/username/dev/project-name/wp-content:/var/www/html/wp-content
- /Users/username/dev/project-name/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
ports:
- "8080:80"
links:
- db:db
volumes:
db_data:
@fieldoffice
Copy link
Author

Process:

  1. Install Docker
  2. Start Docker
  3. Create and cd into development directory - /Users/username/dev/project-name
    $ mkdir project-name
    $ cd project-name
  4. Create docker-compose.yml file
    $ touch docker-compose.yml
  5. Run Docker Compose
    $ docker-compose up -d
  6. Install WordPress by going to http://localhost:8000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment