Understanding PostgresqlDB Persistence on Docker

Asked 1 years ago, Updated 1 years ago, 78 views

I am having trouble mounting the PostgreSQL server directory created by Docker on the host.

Docker is trying to create a database container using PostgreSQL.

to perpetuate data using the postgres formula image Attempt to mount /var/lib/postgresql/data to the vol directory on the host and run it,
I ran the following command, but the container did not start.

Command executed

$docker run-d-p 5432:5432-v`pwd`/vol:/var/lib/postgresql/data postgres: 9.6.2

- -v option was not specified to boot.

Other sites said it could be mounted this way, but is there anything you can think of that might be the reason why the container won't start?

The environment is as follows:

  • Windows 10 (64bit)
  • Docker Quickstart Terminal
  • VirtualBox 5.1.0

I don't know much about it, so I'm sorry if it's a common sense question.
Thank you for your cooperation.

postgresql docker

2022-09-30 21:23

1 Answers

VirtualBox does not use docker, but isn't `pwd` unnecessary?
`pwd`/vol is the absolute path.


2022-09-30 21:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.