JohnDoe
JohnDoe

Reputation: 2513

Migrate data from a data only postgresql docker volume

I have a data only postgresql container

docker create -v /var/lib/postgresql/data --name bevdata mdillon/postgis /bin/true

I have a running Postgis container

docker run --name bevaddress -e POSTGRES_USER=bevsu -e POSTGRES_DB=bevaddress -P -d --volumes-from bevdata mdillon/postgis

I have made a backup of that database into the bavaddress container into directory /var/lib/postgresql/backup

I think this means that the backup data is in container bevaddress (the running process) and NOT the data only container bevdata which I think is good.

Now if I docker pull mdillon/postgis to a new version, how can I attach the folder /var/lib/postgresql/backup of container bevaddress so that a new instance and version of mdillon/postgis can access that folder to restore the database?

Upvotes: 0

Views: 1646

Answers (1)

epic_fil
epic_fil

Reputation: 679

To the best of my knowledge, you cannot. The file system in your running container only exists for the duration of the run. Without mounting a volume, you have no way to allow a second container access to the backup.

For future backups, you could create a second volume only container that mounts /var/lib/postgresql/backup.

Upvotes: 2

Related Questions