Skip to content

Mounting volume on /docker-entrypoint.d prevents postgis initialization #35

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

Closed
johnktims opened this issue Jul 25, 2016 · 4 comments
Closed

Comments

@johnktims
Copy link

I'm using docker-compose and I'd like to run some .sql files when the container starts up, but that conflicts with COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/postgis.sh in the Dockerfile.

  postgresql:
    image: mdillon/postgis:latest
    ports:
      - "5432:5432"
    volumes:
      - ./postgresql:/docker-entrypoint-initdb.d
    environment:
      - POSTGRES_USER=test
      - POSTGRES_PASSWORD=test
      - POSTGRES_DB=test

From what I've read, this is the expected behavior for docker volumes so I don't think this is a bug in your project, but I'm wondering if you're aware of a workaround.

@md5
Copy link
Contributor

md5 commented Jul 25, 2016

Would it be feasible to mount each file individually?

I think it would be worth raising this issue with the parent postgres image. It seems like changing the docker-entrypoint-initdb.d behavior to recurse into subdirectories would be a reasonable change, but I suppose it could be a breaking change for folks who have already put files into subdirectories that they don't expect to have executed or otherwise loaded.

@johnktims
Copy link
Author

johnktims commented Jul 25, 2016

Would it be feasible to mount each file individually?

You're absolutely right. I didn't think that was possible because I had tried - ./postgresql/postgresql.sql:/docker-entrypoint-initdb.d/, but I studied some more examples and noticed that I need to specify the destination file- ./postgresql/postgresql.sql:/docker-entrypoint-initdb.d/postgresql.sql. It's all working now. Sorry for the noise.

@md5
Copy link
Contributor

md5 commented Jul 25, 2016

@johnktims Not noise at all. I think I'll raise an issue against the postgres image to get some broader feedback.

@md5
Copy link
Contributor

md5 commented Jul 25, 2016

@johnktims I've opened docker-library/postgres#179. I didn't tag you in case you're not interested in following the discussion, but feel free to subscribe and/or chime in.

chikcne pushed a commit to chikcne/docker-postgis that referenced this issue Jul 20, 2021
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

2 participants