Skip to content

InitialScript failed Postgres container startup #4841

Answered by kiview
hantsy asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @hantsy, this is related to this issue:
#4441

The best solution is to delegate the script execution to Postgres itself. This can be achieved by copying the file into a special location in the container (a feature of the Postgres image):

new PostgreSQLContainer("postgres:12")
                    .withCopyFileToContainer(
                        MountableFile.forClasspathResource("init.sql"), 
                        "/docker-entrypoint-initdb.d/init.sql"
                     );

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@seanf
Comment options

@seanf
Comment options

@kiview
Comment options

Answer selected by hantsy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
3 participants