Liquibase Docker Redshift Connection Error

When attempting to connect to Redshift from the latest liquibase/liquibase Docker image v4.17.0, Liquibase returns an error:

Unexpected error running Liquibase: Driver class was not specified and could not be determined from the url (jdbc:redshift://aaaa.aaaa.eu-west-2.redshift.amazonaws.com:dddd:/aaaa).

This does not occur with the command-line version of Liquibase v4.17.0, the Redshift driver class is detected and connection works.

When the driver is specified and stored inside the container, Liquibase errors stating it cannot find the database driver, regardless of whether the driver class is specified as com.amazon.redshift.Driver (as specified in the driver JAR) or com.amazon.redshift.jdbc42.Driver (as specified in AWS docs):

Unexpected error running Liquibase: Cannot find database driver: com.amazon.redshift.Driver

Unexpected error running Liquibase: Cannot find database driver: com.amazon.redshift.jdbc42.Driver

Dockerfile:

FROM liquibase/liquibase:latest

COPY entry.sh /entry.sh
ADD https://s3.amazonaws.com/redshift-downloads/drivers/jdbc/2.1.0.9/redshift-jdbc42-2.1.0.9.jar lib/redshift-jdbc42-2.1.0.9.jar
ADD https://github.com/liquibase/liquibase-redshift/releases/download/v4.17.0/liquibase-redshift-4.17.0.jar lib/liquibase-redshift-4.17.0.jar
COPY liquibase.properties liquibase.properties

ENTRYPOINT ["/entry.sh"]

Commaned executed on container (excluding credentials, url, etc.):

docker-entrypoint.sh --defaultsFile=liquibase.properties --classpath=lib/redshift-jdbc42-2.1.0.9.jar

Is there a way to connect from a Liquibase Docker container to Redshift?

ADD in the Dockerfile was extracting the .jar files. Switching to RUN wget fixed the issue.

1 Like