Last active
May 5, 2022 16:30
-
-
Save phunguyen19/b53b738ee03ee06bd9326adc6340d782 to your computer and use it in GitHub Desktop.
start wordpress docker compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "3.9" | |
| services: | |
| db: | |
| image: mysql:5.7 | |
| volumes: | |
| - db_data:/var/lib/mysql | |
| - ./docker/my.cnf:/etc/my.cnf | |
| restart: always | |
| environment: | |
| MYSQL_ROOT_PASSWORD: somewordpress | |
| MYSQL_DATABASE: wordpress | |
| MYSQL_USER: wordpress | |
| MYSQL_PASSWORD: wordpress | |
| wordpress: | |
| depends_on: | |
| - db | |
| image: wordpress:latest | |
| volumes: | |
| - wordpress_data:/var/www/html | |
| ports: | |
| - "80:80" | |
| restart: always | |
| environment: | |
| WORDPRESS_DB_HOST: db | |
| WORDPRESS_DB_USER: wordpress | |
| WORDPRESS_DB_PASSWORD: wordpress | |
| WORDPRESS_DB_NAME: wordpress | |
| volumes: | |
| db_data: {} | |
| wordpress_data: {} |
Author
You'll want to bind mount your
my.cnfso it can be modified without re-creating the container.
Thanks. This is new to me. Just added it. Hope this will help someone.
Add a type parameter to change it to be of type bind on the file, keeping the folder as volume.
https://docs.docker.com/compose/compose-file/compose-file-v3/#volumes
Saw this come up on the public gist feed after I posted a new one. Just trying help ya out :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You'll want to bind mount your my.cnf so it can be modified without re-creating the container.