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

Creating a new image with default data #285

Open
mlaro opened this issue Jul 27, 2018 · 10 comments
Open

Creating a new image with default data #285

mlaro opened this issue Jul 27, 2018 · 10 comments
Labels
documentation resolution of this issue requires fixing documentation easyfix

Comments

@mlaro
Copy link

mlaro commented Jul 27, 2018

HI,
We have some bootstrap data that we would like to have the container always have at a minimum.

Is there a way to modify the image so that it can retain this initial datafill?

Commit does not seem to work .

thanks Mike

@mlaro
Copy link
Author

mlaro commented Jul 30, 2018

help .... the container seems to always re-initialize the DB

@pkubatrh
Copy link
Member

Hi Mike,

I do not think this specific use case is properly documented but you can certainly do that with s2i. You just need to provide the initial data and a custom assemble script that loads in the data when creating the image with s2i.

For an actual example on how to do this you can check out this test case:
https://github.com/sclorg/postgresql-container/blob/master/test/run_test#L711

@mlaro
Copy link
Author

mlaro commented Jul 31, 2018 via email

@pkubatrh
Copy link
Member

pkubatrh commented Aug 1, 2018

As for why docker commit did not work for you I think this is caused by the use of the VOLUME command in our dockerfiles. Docker likely does not include any volumes it creates into the image when the container gets committed.

@mlaro
Copy link
Author

mlaro commented Aug 1, 2018 via email

@praiskup
Copy link
Member

praiskup commented Aug 2, 2018

If you are running on OpenShift, the easiest thing is to use the s2i as @pkubatrh mentioned above (maybe look at slightly clearer link to example s2i app).

If s2i is not what you want, create the Dockerfile manually... Then in Dockerfile COPY the data directory somewhere else then /var/lib/pgsql/data, and move it on place by CMD at container startup.

@mlaro
Copy link
Author

mlaro commented Aug 2, 2018 via email

@mlaro
Copy link
Author

mlaro commented Aug 2, 2018 via email

@praiskup
Copy link
Member

praiskup commented Aug 3, 2018 via email

@praiskup
Copy link
Member

Note to myself, we should add README into https://github.com/sclorg/postgresql-container/tree/master/examples/s2i-dump-data (at least) explaining the basic "howto".

@praiskup praiskup added the documentation resolution of this issue requires fixing documentation label Sep 20, 2018
@pkubatrh pkubatrh self-assigned this Oct 4, 2019
@pkubatrh pkubatrh removed their assignment Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation resolution of this issue requires fixing documentation easyfix
Projects
None yet
Development

No branches or pull requests

3 participants