Using Liquibase and Docker in your CI/CD Pipeline

Many CI/CD tools allow you to deliver changes through your pipeline. Some tools control Liquibase through a plugin and others leverage the Liquibase CLI in a native deployment or a Docker container. This guide contains an example of the Travis CI configuration for running the Liquibase Docker container within your CI/CD Pipeline.

Travis CI is a continuous integration platform, which automates and manages deployments. It supports your development process by automatically building and testing code changes and providing immediate feedback on the success of the change.

Note: For more information, see the Travis CI documentation.

The .travis.yml File

The .travis.yml file is required for Travis CI to run your pipeline. Use the Liquibase example file, which contains attributes described in the table.

Attribute Description
language Represents the language your app uses.
os Represents your operating system.
services Allows to use Docker in your pipeline.
env Includes global environment variables used to define fields required by Liquibase.
before_install Pulls the version of Liquibase Docker image that you want to use in your pipeline.
script Includes the docker run command used to run Liquibase against the changeset.


To use Liquibase and Docker with Travis CI, you needed to:

Running Liquibase and Docker with Travis CI

The following steps are based on the example .travis.yml file and an H2 database. If you want to try it with your changelog and database, you can make a pull request against liquibase-travisci-example repository with your operation, changelog, database username, password, and JDBC URL.

To run Liquibase and Docker with Travis CI:

  1. Fork the liquibase-travisci-example repository by selecting the Fork button at the upper-right corner of the liquibase-travisci-example page.
  2. Clone the liquibase-travisci-example repository by running the following in the CLI:
  3. git clone
  1. Create a new git branch for your changes by running:
  2. git checkout -b <your_branch_name>
  1. Edit example/changelogs/samplechangelog.h2.sql to add a new changeset. Replace yourname with a unique identifier.
  2. --changeset yourname:yourname1
    --rollback DROP TABLE yourname;
    CREATE TABLE yourname (
    id int primary key,
    name varchar(50) not null,
  1. Add, commit, and push your changes to GitHub.
  2. git add example/changelogs/samplechangelog.h2.sql
    git commit -m "yourname: Adding new changeset for example"
    git push origin <your_branch_name>

Your commit triggers a build in Travis CI and executes Liquibase update.

Troubleshooting Issues with Liquibase and Travis CI

If your build fails due to a validation error, verify that your changeset’s author and id are unique in the changelog file. If the Liquibase update fails, verify that your table name is unique in the changelog.

Note: For more information, see Changelog and Changeset.

Related Links