linux - How to store PostgreSQL state in Docker hosts -


postgresql's handling of it's data folder not compatible docker's host mounted folders.

it might work under linux ext4 file systems mounted, on os x or windows, when running

docker run -it --rm -v `pwd`/test:/var/lib/postgresql/data postgres 

initdb terminates in random disk write errors like:

creating template1 database in /var/lib/postgresql/data/base/1 ...  fatal:  not write file "pg_xlog/xlogtemp.25": input/output error 

or

fatal:  not close file "base/1/1249": input/output error fatal:  not close file "base/1/2603": input/output error context:  writing block 0 of relation base/1/1247 

when using named volumes, works well, named volumes not safe way keep data. example in docker mac hidden inside huge qcow2 virtual disk image.

what strategy recommend keeping postgresql's state in non-linux hosts?

should saving backup every n minutes mounted folder , check data folder on startup , restore backup if needed? or should rsync between named volume , host mounted volume? there projects / docker files solved this?


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -