Skip to content

Instantly share code, notes, and snippets.

@wwwebman
Last active February 3, 2023 05:28
Show Gist options
  • Star 26 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save wwwebman/12b4f0123da7a67ff027b06c6bca2d73 to your computer and use it in GitHub Desktop.
Save wwwebman/12b4f0123da7a67ff027b06c6bca2d73 to your computer and use it in GitHub Desktop.
Docker Compose For Wordpress, Maria/MYSQL, phpMyAdmin
version: '2'
services:
db:
container_name: database
image: mariadb # Pull mysql image from Docker Hub
ports: # Set up ports exposed for other containers to connect to
- "3306:3306"
volumes:
- ./dep/mysql:/docker-entrypoint-initdb.d
environment: # Set up mysql database name and password
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
image: wordpress
container_name: wordpress
depends_on:
- db
ports:
- "80:80"
volumes: # Mount relative path source folder on host to absolute path destination folder on docker container
- ./theme:/var/www/html/wp-content/themes/theme_name
- ./dep/plugins:/var/www/html/wp-content/plugins
- ./dep/uploads:/var/www/html/wp-content/uploads
links:
- db
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_PASSWORD: wordpress
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
depends_on:
- db
restart: always
ports:
- "8080:80"
environment:
- PMA_ARBITRARY=1
@zkenstein
Copy link

Nice script, but how to edit the wp config?

@NaveenKharwar
Copy link

NaveenKharwar commented Mar 8, 2019

Hey @zkenstein , You can use this docker-compose file. this will mount all WordPress files inside your home in /wordpress/wp_html folder .

wordpress:
image: wordpress
links:
- wordpress_db:mysql
ports:
- 8080:80
volumes:
- ~/wordpress/wp_html:/var/www/html
wordpress_db:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: examplepass
phpmyadmin:
image: phpmyadmin/phpmyadmin
links:
- wordpress_db:mysql
ports:
- 8181:80
environment:
MYSQL_USERNAME: root
MYSQL_ROOT_PASSWORD: examplepass

@LeoSeyers
Copy link

Hi, any reasons why it would pull Wordpress version 5.0.2 instead of the latest 5.1.1?
I cannot update it manually either, it fails at some point. Not sure if it's due to permissions or somehting.

@LeoSeyers
Copy link

Hi, any reasons why it would pull Wordpress version 5.0.2 instead of the latest 5.1.1?
I cannot update it manually either, it fails at some point. Not sure if it's due to permissions or somehting.

What a fool I am, just had to update my Wordpress image locally

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