Skip to content

Instantly share code, notes, and snippets.

@cyruzin
Last active July 31, 2022 00:35
Show Gist options
  • Save cyruzin/7ec85a206ee36c5d51df863e134126d9 to your computer and use it in GitHub Desktop.
Save cyruzin/7ec85a206ee36c5d51df863e134126d9 to your computer and use it in GitHub Desktop.
MySQL/MariaDB Docker Healthcheck
version: "3.9"
services:
mariadb:
image: mariadb:10.8.3
container_name: database
hostname: database
restart: unless-stopped
volumes:
- ./db/mariadb:/docker-entrypoint-initdb.d
- ./db/mariadb/.data:/var/lib/mysql
ports:
- ${DB_PORT}:${DB_PORT}
environment:
- MARIADB_ROOT_PASSWORD=${DB_PASS}
healthcheck:
test: ["CMD", "mysqladmin", "-u$DB_USER", "-p$DB_PASS", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5
env_file: .env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment