You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am using a set of SQL files to populate my database with sample data on first time starting up the container.
but each time after that even if the container is stopped and I'm restarting it, it re-executes all the SQL files which result in errors during Inserts (due to unique constraints in DB tables).
Can we change the startup.sh so that we can check, if the data is already mounted, if yes, then skip SQL file execution.
I was trying something on the lines of https://github.com/MaksymBilenko/docker-oracle-12c/blob/master/entrypoint.sh
but it is resulting in the abrupt exit of the container.
The text was updated successfully, but these errors were encountered:
Yes, it would be much better to have the scripts run only once, when the database is first initialized.
That way, it would also resemble more to the official PostgreSQL container (which is much more widely used and well known for Docker users) thus be more familiar.
As it is, I have to put a lot of extra efforts into ensuring that the init scripts all check that they have not yet been executed. It cannot be used very well in this form.
I've come up with a temporary fix to address this issue. I've replaced the entrypoint.sh in the image by a custom script which deletes the SQL insert scripts once the run is successful. Thus, the scripts are not re-run on restart.
Hi,
I am using a set of SQL files to populate my database with sample data on first time starting up the container.
but each time after that even if the container is stopped and I'm restarting it, it re-executes all the SQL files which result in errors during Inserts (due to unique constraints in DB tables).
Can we change the startup.sh so that we can check, if the data is already mounted, if yes, then skip SQL file execution.
I was trying something on the lines of
https://github.com/MaksymBilenko/docker-oracle-12c/blob/master/entrypoint.sh
but it is resulting in the abrupt exit of the container.
The text was updated successfully, but these errors were encountered: