Skip to content

Instantly share code, notes, and snippets.

@bmcculley
Last active June 22, 2021 00:08
Show Gist options
  • Save bmcculley/d61e37a05331c266033a4bf1b7a6b956 to your computer and use it in GitHub Desktop.
Save bmcculley/d61e37a05331c266033a4bf1b7a6b956 to your computer and use it in GitHub Desktop.
Docker Compose File For Wordpress and MariaDB
version: '3'
services:
# Database
db:
image: mariadb:latest
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MARIADB_ROOT_PASSWORD: rootpassword
MARIADB_DATABASE: wordpress
MARIADB_USER: wpuser
MARIADB_PASSWORD: password
networks:
- wpsite
# Apache, PHP, WordPress
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- '8080:80'
restart: always
volumes: ['./:/var/www/html']
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wpuser
WORDPRESS_DB_PASSWORD: password
networks:
- wpsite
networks:
wpsite:
volumes:
db_data:
@bmcculley
Copy link
Author

Builds, (re)creates, starts, and attaches to containers for a service

docker-compose up -d

Stops containers and removes containers, networks, volumes, and images created by up

docker-compose down --volumes

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