SQL error cause docker postgres image init script to stop

  docker, docker-compose, postgresql

I have a SQL script that fill a database. Usually, I run it with i myScript.sql, the script is generated from another database so it contains errors but that’s not a problem. Now I need to execute it at the start of docker-compose.

According to the documentation of the docker postgres image, the execution of init scripts (.sh or .sql) in /docker-entrypoint-initdb.d stops when it encounter an error :
https://hub.docker.com/_/postgres

How can I ignore errors and make script continue ?

Source: Docker Questions

LEAVE A COMMENT