Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
docker compose for wordpress
version: '3.6'
services:
nginx:
image: nginx:latest
container_name: nginx
ports:
- '80:80'
- '443:443'
volumes:
- ./nginx:/etc/nginx/conf.d
- ./logs/nginx:/var/log/nginx
- ./wordpress:/var/www/html
- ./certs:/etc/letsencrypt
- ./certs-data:/data/letsencrypt
links:
- wordpress
restart: always
mysql:
image: mariadb
container_name: mysql_wp
volumes:
- ./mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_USER=wp_user # same as WORDPRESS_DB_USER
- MYSQL_PASSWORD=wp_password # same as WORDPRESS_DB_PASSWORD
- MYSQL_DATABASE=wordpress # same as WORDPRESS_DB_NAME
restart: always
wordpress:
image: wordpress:php7.2-fpm
container_name: wordpress
volumes:
- ./wordpress:/var/www/html
ports:
- '9000:9000'
environment:
- WORDPRESS_DB_NAME=wordpress
- WORDPRESS_TABLE_PREFIX=wp_
- WORDPRESS_DB_HOST=mysql
- WORDPRESS_DB_PASSWORD=wp_password # new DB password
- WORDPRESS_DB_USER=wp_user # new DB user
links:
- mysql
restart: always
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.