Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker,Error: cannot run migrations: database needs bootstrapping;

This is what I have tried

docker run --rm \
> --link kong-database:kong-database \
> -e "KONG_DATABASE=postgres" \
> -e "KONG_PG_HOST=kong-database" \
> kong:latest kong migrations up

But I have

Error: cannot run migrations: database needs bootstrapping; run 'kong migrations bootstrap'

I do not understand what this actually means. If I try

docker run --rm --link kong-database:kong-database -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" kong:latest kong migrations bootstrap
bootstrapping database...
Error: [PostgreSQL error] failed to bootstrap database: ERROR: syntax error at or near "NOT" (150)

I inspected kong-database

 {
        "Id": "d94ac442da9a399c1b865de49904e01085abe1ed8f0871af5830810c4c2a78dd",
        "Created": "2019-04-19T07:18:59.534751317Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "postgres"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 18342,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2019-04-19T07:19:00.129193458Z",
            "FinishedAt": "0001-01-01T00:00:00Z"

How it comes that I need to bootstrap database and why do I have problem?

like image 407
Richard Rublev Avatar asked Jan 26 '23 10:01

Richard Rublev


1 Answers

You have to bootstrap the database before running kong. The up command is deprecated and replaced with bootstrap

Change

kong:latest kong migrations up

To

kong:latest kong migrations bootstrap

like image 137
Anis D Avatar answered Jan 29 '23 01:01

Anis D