Docker Community Forums

Share and learn in the Docker community.

Mount host folder from repo as data for postgress


(Mordraug) #1

I’m trying to mount folder from my repository as data folder for postgress container (database with tests data), but it seems like I can’t do it normal way, since host folders are always mounted as root which results in:

FATAL:  data directory "/var/lib/postgresql/data" has wrong ownership

The only way I found so far was to, instead of mounting it, simply copy data to image, but this is inconvinient as it requires rebuilding image each time data changes.

Is there any way to mount folder from repo as user instead of root?