I know there have been couple of discussions on this topic and I have followed through them–
- postgresql - Liquibase via Docker - Changelog is not written to disk - Stack Overflow
- [Unable to setup liquibase using docker image - General Discussion - Liquibase]
(Unable to setup liquibase using docker image - #12 by MikeOlivas),
But my issues still persist, that is I still can not generate changelog to my local linux system.
liquibase.docker.properties
classpath: /liquibase/changelog
url: jdbc:postgresql://rdsurl:1234/testdb?currentSchema=public
changeLogFile: changelog.xml
username: testuser
password: TestPwd
-
The following command run successfully and if I access the liquibase container, I can see changelog.xml put in the liquibase container /liquibase directory . But I can’t access from the local host;
docker run --rm --net=“host” -v /home/user/docker/init-liquibase/changelog:/liquibase/changelog liquibase/liquibase --defaultsFile=/liquibase/changelog/liquibase.docker.properties –changeLogFile=changelog.xml generateChangeLog --log-level flag -
If I follow the links above to put absolute path in front the changlog.xml, I get error.
docker run --rm --net=“host” -v /home/user/docker/init-liquibase/changelog:/liquibase/changelog liquibase/liquibase --defaultsFile=/liquibase/changelog/liquibase.docker.properties –changeLogFile=/liquibase/changelog/changelog.xml generateChangeLog --log-level flag
Error log–
BEST PRACTICE: The changelog generated by diffChangeLog/generateChangeLog should be inspected for correctness and completeness before being deployed. Some database objects and their dependencies cannot be represented automatically, and they may need to be manually updated before being deployed.
[2023-02-24 02:09:15] INFO [liquibase.database] Set default schema name to public
[2023-02-24 02:09:16] INFO [liquibase.diff] changeSets count: 43
[2023-02-24 02:09:16] INFO [liquibase.diff] liquibase/changelog/changelog.xml does not exist, creating and adding 43 changesets.
[2023-02-24 02:09:16] WARNING [liquibase.resource] Failed to create parent directories for file /liquibase/changelog/changelog.xml
[2023-02-24 02:09:16] SEVERE [liquibase.integration] /liquibase/changelog/changelog.xml
liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: liquibase.exception.CommandExecutionException: java.nio.file.AccessDeniedException: /liquibase/changelog/changelog.xml
at liquibase.command.CommandScope.execute(CommandScope.java:186)
at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:55)
at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:24)
at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
at picocli.CommandLine.execute(CommandLine.java:2170)
at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$1(LiquibaseCommandLine.java:352)
at liquibase.Scope.child(Scope.java:189)