V
V
Vlad2021-10-15 17:09:31
PostgreSQL
Vlad, 2021-10-15 17:09:31

How to fix volumes mapping error (initdb: error: directory "/var/lib/postgresql/data" exists but is not empty)?

Hello! I'm trying to link volume inside the container with an external directory using this command.

docker run --name PSTGRS -p 5432:5432 -v /home/****/Desktop/pagila-master:/var/lib/postgresql/data  -e GRANT_SUDO=yes -e POSTGRES_PASSWORD=password postgres


But I am getting an error:

initdb: error: 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".


The command docker inspect PSTGRSissues:

"Mounts": [
            {
                "Type": "bind",
                "Source": "/home/***/Desktop/pagila-master",
                "Destination": "/var/lib/postgresql/data",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],


I have already tried docker system purge and what I just haven't tried. This error every time.

Tell me, please, what am I doing wrong?

Thank you very much in advance!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Startsev, 2014-12-12
@Limme

In the end, I also came to the MacBook, although in fact this is a matter of taste, since you can normally do development, in fact, on any modern machine. In a MacBook, I bribed an unrealistically convenient touchpad, a long-lived battery, and the retina is wildly pleasing to the eye. I can only advise you to take at least 8 GB of RAM - this is the most reasonable minimum for comfortable work.

R
Roman Frank, 2014-12-12
@Akellacom

I have a MacBook Pro Retina 13. Great laptop for work.
Often an editor, photoshop, git client, social network clients, iTunes with streaming on Apple TV are open.
Flight normal :)

V
Vadim, 2014-12-12
@MrQuest

All the same, I would look more towards 15 ", 13 is too small for me.
In terms of models, the MacBook is a good thing, I also recommend taking a look at the HP EliteBook 840.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question