Liquibase Docker generateChangeLog Failed to create parent directories for file /liquibase/changelog/changelog.xml

I know there have been couple of discussions on this topic and I have followed through them–

  1. postgresql - Liquibase via Docker - Changelog is not written to disk - Stack Overflow
  2. [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.
classpath: /liquibase/changelog
url: jdbc:postgresql://rdsurl:1234/testdb?currentSchema=public
changeLogFile: changelog.xml
username: testuser
password: TestPwd

  1. 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/ –changeLogFile=changelog.xml generateChangeLog --log-level flag

  2. 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/ –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(
at picocli.CommandLine.executeUserObject(
at picocli.CommandLine.access$1500(
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(
at picocli.CommandLine$RunLast.handle(
at picocli.CommandLine$RunLast.handle(
at picocli.CommandLine$AbstractParseResultHandler.execute(
at picocli.CommandLine$RunLast.execute(
at picocli.CommandLine.execute(
at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$1(
at liquibase.Scope.child(

Hi @karenxbai Thanks for joining the community.
Try changing your changelog file name to

In the container liquibase runs from /liquibase
so that means that in the container the changelog directory is in ./changelog
or /liquibase/changelog.
Outside of the container (your filesystem) it will be your mount point.

Visual way to the look at it.
home/user/docker/init-liquibase/changelog ← your local filesystem

In the container
/liquibase ← where liquibase binary runs when you issue liquibase commands (non accessbile after the commands run)
/liquibase/changelog ← anything mounted here (using -v parameter) will be accessible after liquibase finishes

When you use liquibase --changelog-file=somename.xml
The container will place the file in the container in the /liquibase folder which cannot be accessed post run
Hopefully that clarifies things.

@MikeOlivas Thanks a lot for the reply and instruction.
But I still got similar errors after use changeLogFile=./changelog/changelog.xml:
See the below updated command and respective error. Why there is always an action try to create parent directory of the “changeLogFile”?
I know that the container /liquibase/changelog is accessible since the defaultsFile=/liquibase/changelog/ can be accssed.

docker run --rm --net=“host” -v /home/user/docker/init-liquibase/changelog:/liquibase/changelog liquibase/liquibase --defaultsFile=/liquibase/changelog/ --changeLogFile=./changelog/changelog.xml generateChangeLog --log-level flag > log022401 2>&1

[2023-02-24 18:41:04] INFO [liquibase.diff] ./changelog/changelog.xml does not exist, creating and adding 43 changesets.
[2023-02-24 18:41:04] WARNING [liquibase.resource] Failed to create parent directories for file changelog/changelog.xml
[2023-02-24 18:41:04] SEVERE [liquibase.integration] changelog/changelog.xml
liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: liquibase.exception.CommandExecutionException: java.nio.file.AccessDeniedException: changelog/changelog.xml