-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"data" folder is always empty #103
Comments
Could you past the full Docker run command you use to start your PostgreSQL database? |
I believe you need to mount with /registry:/var/lib/postgresql/data.
The empty “data" directory is the mount point directory created when the
Docker-managed /var/lib/postgresql/data directory is mounted.
|
I also see this issue with the following
Is there something I'm missing? |
I think you need the
|
Indeed. Because "/var/lib/postgresql/data" is marked as a VOLUME in the
Dockerfile, Docker will always create a new volume there unless it's
explicitly mounted over top of, even if "/var/lib/postgresql" is a volume
above it.
|
What is the benefit of marking any volumes in the Dockerfile? If this prevents people defining their own mappings? |
It doesn't really prevent folks from defining their own mappings, but the
reason to do it is so that in the default case of no volume specified
explicitly, we still get a volume and don't suffer the performance penalty
of running our database storage directly on the CoW filesystem (which in
some cases can be really significant). Additionally, it allows Docker
Compose to work out-of-the-box with proper data persistence, and acts as a
note to the image user that this is where the mutable state of the
container will be.
|
@tianon - Thanks for the info. It seems there is more I need to learn about using Docker. |
Our pg-data named volume mounted to /var/lib/postgresql was always empty because an anonymous volume mounted to /var/lib/postgresql/data was already defined in the Dockerfile of the postgres image from which our postgis image is based. See: * https://stackoverflow.com/questions/41637505/how-to-persist-data-in-a-dockerized-postgres-database-using-volumes * docker-library/postgres#103 * docker-library/postgres#265 * https://github.com/docker-library/postgres/blob/master/13/Dockerfile#L180-L183 * https://github.com/postgis/docker-postgis/blob/master/13-3.1/Dockerfile
Our pg-data named volume mounted to /var/lib/postgresql was always empty because an anonymous volume mounted to /var/lib/postgresql/data was already defined in the Dockerfile of the postgres image from which our postgis image is based. See: * https://stackoverflow.com/questions/41637505/how-to-persist-data-in-a-dockerized-postgres-database-using-volumes * docker-library/postgres#103 * docker-library/postgres#265 * https://github.com/docker-library/postgres/blob/master/13/Dockerfile#L180-L183 * https://github.com/postgis/docker-postgis/blob/master/13-3.1/Dockerfile
I have mounted
/registry:/var/lib/postgresql
to postgres:9.3 and 9.4.Also mounted: create_db.sql:/docker-entrypoint-initdb.d/create_db.sql
I see that this sql file is get executed but nothing has been created inside /var/lib/postgresql (my case /registry) just an empty folder called data and nothing more.
If I try to use initdb then is raised an exception that the data folder is not empty.
The text was updated successfully, but these errors were encountered: