Skip to content

Using volumes for persistent data:'initdb: directory "/var/lib/postgresql/data" exists but is not empty' #263

@ambrt

Description

@ambrt

I want to use docker volume named "taiga-postgres-pers" to store postgres data between removing ( postgres container (named "taiga-postgres")

The code for "taiga-postgres" is:

docker run \
--name taiga-postgres \
 -v taiga-postgres-pers:/var/lib/postgresql/data \
-e POSTGRES_PASSWORD=mypassword   -d postgres

The container exits immediately with error in logs:

initdb: directory "/var/lib/postgresql/data" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/var/lib/postgresql/data" or run initdb
with an argument other than "/var/lib/postgresql/data".

So how can i attach existing volume to newly created postgres docker container?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions