Skip to content

Instantly share code, notes, and snippets.

@duaneleem
Last active Jan 18, 2021
Embed
What would you like to do?
Example Docker Compose file that links WordPress container to an already running MySQL container using external links.
version: '3'
services:
wordpress:
image: wordpress:4.9.4-php7.0-apache
network_mode: bridge
external_links:
- db-mysql:db
volumes:
- "./wp-content/themes:/var/www/html/wp-content/themes"
- "./wp-content/plugins:/var/www/html/wp-content/plugins"
- "./wp-content/uploads:/var/www/html/wp-content/uploads"
- "./.htaccess:/var/www/html/.htaccess"
ports:
- "8080:80"
restart: always
container_name: wordpress-dev
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_NAME: wordpress_dev
WORDPRESS_DB_USER: someusername
WORDPRESS_DB_PASSWORD: somepassword
@bosbyj
Copy link

bosbyj commented May 2, 2019

Thank you! The gist is really helpful.

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