Skip to content
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

Closed
CyborTronik opened this issue Oct 31, 2015 · 8 comments
Closed

"data" folder is always empty #103

CyborTronik opened this issue Oct 31, 2015 · 8 comments

Comments

@CyborTronik
Copy link

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.

@Starefossen
Copy link

Could you past the full Docker run command you use to start your PostgreSQL database?

@md5
Copy link
Contributor

md5 commented Nov 1, 2015 via email

@tgandrews
Copy link

I also see this issue with the following docker-compose.yml

db:
  image: postgres
  volumes:
    - ./data:/var/lib/postgresql
api:
  build: ./api
  links:
    - db
  volumes:
    - ./api:/myapp

Is there something I'm missing?

@yosifkit
Copy link
Member

I think you need the data directory as well.

  volumes:
    - ./data:/var/lib/postgresql/data

@tianon
Copy link
Member

tianon commented Dec 28, 2015 via email

@tgandrews
Copy link

What is the benefit of marking any volumes in the Dockerfile? If this prevents people defining their own mappings?

@tianon
Copy link
Member

tianon commented Dec 29, 2015 via email

@tgandrews
Copy link

@tianon - Thanks for the info. It seems there is more I need to learn about using Docker.

huygn added a commit to huygn/django-tutorial-docker that referenced this issue Apr 5, 2016
anthonyfok added a commit to OpenDRR/opendrr-api that referenced this issue Jun 14, 2021
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
anthonyfok added a commit to OpenDRR/opendrr-api that referenced this issue Jun 14, 2021
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants