Skip to content

Instantly share code, notes, and snippets.

@uchilaka
Created January 5, 2018 21:12
Show Gist options
  • Save uchilaka/77db0b4740daa2beb368909de3628608 to your computer and use it in GitHub Desktop.
Save uchilaka/77db0b4740daa2beb368909de3628608 to your computer and use it in GitHub Desktop.
Wordpress In Docker
version: '2'
services:
db:
container_name: wp-mysql
ports:
- 8086:3306
image: mysql/mysql-server:5.7
restart: unless-stopped
environment:
MYSQL_DATABASE: uc-wordpress
MYSQL_ROOT_PASSWORD: y0ur-password
volumes:
- ./data/db/mysql:/var/lib/mysql
- ./conf.d:/etc/mysql/conf.d
# NOTE ON NETWORKING
# be aware that network subnets can either be maintained outside of your compose script, or within - but if within, will need to NOT co-incide with other compose scripts deploying to the same docker engine
# you can even get as specific as assigning IP addresses within the virutal network spun up by the Docker Engine to run your containers
# networks:
# vmnet:
# ipv4_address: 4.11.0.3
wp:
container_name: uc-wordpress
environment:
WORDPRESS_DB_NAME: uc-wordpress
WORDPRESS_DB_HOST: db:3306
# create these credentials manually after the initialization of the database i.e. 'crud'@'%' via `docker exec...`
WORDPRESS_DB_USER: crud
WORDPRESS_DB_PASSWORD: an0ther-password
ports:
- 7310:80
restart: unless-stopped
image: uchilaka/uc-wordpress:dev
build:
context: .
volumes:
# - ./data/wordpress-dev:/var/www/html
- ./data/wordpress:/var/www/html
depends_on:
- db
# command: ["/usr/shared/app/node_modules/wait-for-it/wait-for-it.sh", "db:3306", "--", "apache2-foreground"]
# networks:
# vmnet:
# ipv4_address: 4.11.0.11
# networks:
# vmnet:
# driver: bridge
# ipam:
# config:
# - subnet: 4.11.0.0/16
# gateway: 4.11.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment