-
-
Save tareksamni/021d53c8994831662169dddc4decd7df to your computer and use it in GitHub Desktop.
| version: '2.1' | |
| services: | |
| db: | |
| image: bla_bla:1234/mysql:5.6 | |
| environment: | |
| - MYSQL_ROOT_PASSWORD=XXXX | |
| - MYSQL_DATABASE=bla_bla_dev | |
| - MYSQL_USER=XXXX | |
| - MYSQL_PASSWORD=XXXX | |
| ports: | |
| - 3306 | |
| healthcheck: | |
| test: "/etc/init.d/mysql status" | |
| interval: 1s | |
| retries: 120 | |
| app: | |
| build: . | |
| command: /bin/bash -lc "whoami" | |
| volumes: | |
| - .:/app | |
| environment: | |
| - DB_HOST=db | |
| - DB_NAME=bla_bla_dev | |
| - DB_USERNAME=XXXX | |
| - DB_PASSWORD=XXXX | |
| links: | |
| - db | |
| depends_on: | |
| db: | |
| condition: service_healthy |
conditionindepends_onis no longer supported from v3.0 and above.
Oh, god, why?
Oh, god, why?
The support was added back again
Oh, god, why?
The support was added back again
woohoo!
@Luc45 lu @fdorantesm hi, does this ensure that(test: "/etc/init.d/mysql status") the database has been created?
I found another way
test: ["CMD", "mysql" ,"-h", "mysql", "-P", "3306", "-u", "root", "-e", "SELECT 1", "cache"]
This execution failed:
Access denied for user 'root'@'172.25.0.3' (using password: NO)
I tried to add a password
["CMD", "mysql" ,"-h", "mysql", "-P", "3306", "-u", "root", "-p", "111111", "-e", "SELECT 1", "cache"]
This execution failed:
^[container for service "mysql" is unhealthy
I don't know how to write it
I tried both and got the same results. I found this - maybe this will help? I still didn't try it myself ...
@wajdijurry,
4 years agofile :) where did you find it?