Skip to content

Instantly share code, notes, and snippets.

@duaneleem
Last active January 18, 2021 02:21
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save duaneleem/0fc9a998a15c8e2bf67cd50db3c6e01a to your computer and use it in GitHub Desktop.
Save duaneleem/0fc9a998a15c8e2bf67cd50db3c6e01a to your computer and use it in GitHub Desktop.
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