Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 3

MariaDB / MySQL service is unealthy

Solved! Go to Solution.

Hello,

 

I've tried multiple combinaison, but it seems I can't figure out why is mariadb not starting.

I've look mutliple examples (such as this one) but nothing is working (including changing port to 3366);

 

The output log is :

 

 

Status: Downloaded newer image for mariadb:10.4
docker.io/library/mariadb:10.4
/usr/bin/docker create --name 88c5e4e016ef4568bc6bf49cd2b81d61_mariadb104_4b3bb7 --label 488dfb --network github_network_674333f1aba94d138fe92f85cd90c518 --network-alias mysql -p 3306/tcp --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10 -e GITHUB_ACTIONS=true mariadb:10.4
b62b9146f0bd1f3512327ee67357e76827c31c03d9f2fd2c9d06c3648b98ce0f
/usr/bin/docker start b62b9146f0bd1f3512327ee67357e76827c31c03d9f2fd2c9d06c3648b98ce0f
b62b9146f0bd1f3512327ee67357e76827c31c03d9f2fd2c9d06c3648b98ce0f
/usr/bin/docker ps --all --filter id=b62b9146f0bd1f3512327ee67357e76827c31c03d9f2fd2c9d06c3648b98ce0f --filter status=running --no-trunc --format "{{.ID}} {{.Status}}"
b62b9146f0bd1f3512327ee67357e76827c31c03d9f2fd2c9d06c3648b98ce0f Up Less than a second (health: starting)
/usr/bin/docker port b62b9146f0bd1f3512327ee67357e76827c31c03d9f2fd2c9d06c3648b98ce0f
3306/tcp -> 0.0.0.0:32768
/usr/bin/docker inspect --format="{{if .Config.Healthcheck}}{{print .State.Health.Status}}{{end}}" b62b9146f0bd1f3512327ee67357e76827c31c03d9f2fd2c9d06c3648b98ce0f
starting
mysql service is starting, waiting 2 seconds before checking again.
/usr/bin/docker inspect --format="{{if .Config.Healthcheck}}{{print .State.Health.Status}}{{end}}" b62b9146f0bd1f3512327ee67357e76827c31c03d9f2fd2c9d06c3648b98ce0f
unhealthy
##[error]Failed to initialize, mysql service is unhealthy.

 

 

 

env:
TZ: Europe/Paris
PHP_VERSION: 7.4
NODE_VERSION: 10.x
COMPOSER_ALLOW_SUPERUSER: '1' # https://getcomposer.org/doc/03-cli.md#composer-allow-superuser

# Database
MYSQL_ROOT_PASSWORD: symfony
MYSQL_DATABASE: symfony


jobs:
php:
runs-on: ubuntu-latest
services:
mysql:
image: mariadb:10.4
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10 

 

2 Replies
Highlighted
Solution
GitHub Partner
Message 2 of 3

Re: MariaDB / MySQL service is unealthy

Hi @tristanbes ,

 

This is due to the top level env setting is not applied to the github services(‘docker create’ command in the execution step). Need to set in ‘jobs.<job_id>.services.env’ level. Code sample below:

env:
    TZ: Europe/Paris
    PHP_VERSION: 7.4
    NODE_VERSION: 10.x
    COMPOSER_ALLOW_SUPERUSER: '1' # https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
jobs:
    php:
        runs-on: ubuntu-latest
        services:
            mysql:
                image: mariadb:10.4
                env:
                  MYSQL_ROOT_PASSWORD: symfony
                  MYSQL_DATABASE: symfony
                ports:
                  - 3306/tcp
                options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10

mariaDB.png

Highlighted
Copilot Lvl 2
Message 3 of 3

Re: MariaDB / MySQL service is unealthy

Thank you very much. I didn't know that.