-
Notifications
You must be signed in to change notification settings - Fork 1.2k
How to use as a base image? #16
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
Comments
I think the problem is that the database does not exist until the entrypoint script is run. We do this in case a user bind mounts in their own volume for the data as it is not accessible until runtime. A possible solution is to copy the current entrypoint to your build dir and extend it with your needed options (createdb, createuser) and |
Take a look at how I've extended the docker-entrypoint.sh initialization here: https://github.com/md5/docker-postgis/blob/master/docker-entrypoint.sh#L10-17 |
Yeah, this should be solved by #23 which just merged a little bit ago. 😄 |
See also docker-library/docs#71 for the documentation of it! ❤️ |
@suan check out how I've used this new functionality in a derived image for PostGIS: |
I ran into some unfortunate confusion with this. The documentation change from docker-library/docs#71 appears at https://registry.hub.docker.com/_/postgres/, but the images pulled from there do not yet have #23. It works fine when the image is built from this repo, but there was some head scratching before I noticed the discrepancy. |
Sorry, @watsonkp. We will get the new images up in just a bit. |
Looks good, thanks. |
Hi im looking for an example on how to import a gosu postgres postgres --single stash -j < /tmp/stash.dump but it didn't work ... |
OK I found a solution ... but its kinda awkward :-( if [ -r '/tmp/db.dump' ]; then
echo "**IMPORTING DATABASE BACKUP**"
gosu postgres postgres &
PID=$!
sleep 2
gosu postgres psql db < /tmp/db.dump
kill $PID
sleep 2
echo "**DATABASE BACKUP IMPORTED***"
fi |
The less awkward solution is to |
Yes I used to do it this way, but now I have this image as part of a fig orchestration. The problem is, the other container I start are unusable without the db content. So I have to start the orchestration, replay the database then restart everything ... look at https://github.com/mhubig/atlassian for reverence. |
The original issue here has been fixed. (There could be documentation improvements for something like importing a |
I'm trying to use this as a base image, and set different databases and users in my Dockerfile, but am having trouble accessing the files in mounted as
VOLUME
. Here's what I have:Dockerfile
setup_db.sh
But when I try to build my image I get:
Any advice?
The text was updated successfully, but these errors were encountered: