'Unable to execute Liquibase update commands via Docker run

I am using docker here to build Liquibase and trying to execute Liquibase commands on fly.

Here is the Dockerfile:-

FROM liquibase/liquibase
RUN lpm add mysql --global

I am using below command on fly

docker run --rm -v ${bamboo.build.working.directory}/:/liquibase/changelog liquibase/liquibase --url="jdbc:postgresql://app-liquibase-test.us-region.rds.amazonaws.com:5432/database?currentSchema=schema" --changeLogFile=sql/changelog/db.changelog-master.xml --username=username --password=password update

I am getting below error:-

error   04-May-2022 22:08:38    Starting Liquibase at 05:08:38 (version 4.9.1 #1978 built at 2022-03-28 19:39+0000)
error   04-May-2022 22:08:38    Liquibase Version: 4.9.1
error   04-May-2022 22:08:38    Liquibase Community 4.9.1 by Liquibase
error   04-May-2022 22:08:48    
error   04-May-2022 22:08:48     Unexpected error running Liquibase: Connection could not be created to jdbc:postgresql://app-liquibase-test.us-region.rds.amazonaws.com:5432/database?currentSchema=schema with driver org.postgresql.Driver. The connection attempt failed.

Please suggest



Solution 1:[1]

From this October 2021 GitHub issue, you need to use single quotes around your JDBC driver URL instead of double-quotes. Try entering it as edited below.

docker run --rm -v ${bamboo.build.working.directory}/:/liquibase/changelog liquibase/liquibase --url='jdbc:postgresql://app-liquibase-test.us-region.rds.amazonaws.com:5432/database?currentSchema=schema' --changeLogFile=sql/changelog/db.changelog-master.xml --username=username --password=password update

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tabbyfoo