version: '2.1' services: web: build: context: . dockerfile: Dockerfile command: bash -c "/usr/bin/true" # I run tests from here container_name: foo_web depends_on: db: condition: service_healthy db: image: mariadb:latest container_name: foo_db restart: always healthcheck: test: "/usr/bin/mysql --user=foo --password=foo --execute \"SHOW DATABASES;\"" # test: "/usr/local/mysql/bin/mysql --user=foo --password=foo --execute \"SHOW DATABASES;\"" interval: 3s timeout: 1s retries: 5 environment: MYSQL_DATABASE: foo MYSQL_USER: foo MYSQL_PASSWORD: foo