-
-
Save katoba86/ebd024d390c0f826a145f2ec904c4d8f to your computer and use it in GitHub Desktop.
Simple Docker-Compose.yml for a MySQL database. Uses the same naming convention as Laravel .env files.
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
DB_PASSWORD=veryverysecure | |
DB_DATABASE=testdb | |
DB_USERNAME=kimmie | |
DB_PORT=3306 |
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
services: | |
mysql: | |
image: 'mysql/mysql-server:latest' | |
ports: | |
- '${DB_PORT:-3306}:3306' | |
environment: | |
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' | |
MYSQL_ROOT_HOST: '%' | |
MYSQL_DATABASE: '${DB_DATABASE}' | |
MYSQL_USER: '${DB_USERNAME}' | |
MYSQL_PASSWORD: '${DB_PASSWORD}' | |
MYSQL_ALLOW_EMPTY_PASSWORD: 1 | |
volumes: | |
- 'mysql:/var/lib/mysql' | |
networks: | |
- default | |
healthcheck: | |
test: | |
- CMD | |
- mysqladmin | |
- ping | |
- '-p${DB_PASSWORD}' | |
retries: 3 | |
timeout: 5s | |
networks: | |
default: | |
driver: bridge | |
volumes: | |
mysql: | |
driver: local | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment