Using Liquibase And Docker with Travis CI

Last updated: July 14, 2025

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 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 you to use Docker in your pipeline.

env

Includes global environment variables used to define fields required by Liquibase.

before_install

Pulls the version of the Liquibase Docker image that you want to use in your pipeline.

script

Includes the docker run command used to run Liquibase against the changeset.

Before you begin

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

Note: For more information on how to create a GitHub account, see Signing Up for GitHub.

Procedure

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.

git clone git@github.com:/liquibase/liquibase-travisci-example.git
3

Create a new git branch for your changes by running.

git checkout -b <your_branch_name>
4

Edit example/changelogs/samplechangelog.h2.sql to add a new changeset. Replace yourname with a unique identifier.

--changeset yourname:yourname1
--rollback DROP TABLE yourname;
CREATE TABLE yourname (id int PRIMARY key, name varchar(50) NOT NULL,)
5

Add, commit, and push your changes to GitHub.

git add example/changelogs/samplechangelog.h2.sql
git commit -m "yourname: Adding new changeset for example"
git push origin <your_branch_name>