Create a custom image with Docker

Last updated: July 14, 2025

If you cannot use the default Liquibase Docker container image, you can create a custom image. You can either extend an existing Dockerfile or create a completely new image.

Extend Dockerfile

The best way to create a custom Docker image is to extend the Dockerfile to add whatever tools or drivers you want, such as a native executor. Then, publish your extended Dockerfile internally in your organization. For example, see /docker/examples, which contains both Alpine and non-Alpine Dockerfile examples.

To add a driver, see the "Drivers and extensions" section. Alternatively, you can use the Liquibase Package Manager (lpm) to inject the driver into your container:

FROM liquibase:latest RUN lpm add mssql --global

Then publish this custom Docker image internally. If you need to create a new image instead, follow the steps below.

Procedure

1

Download the latest Microsoft SQL Server driver, for example 12.2.0.

2

Start a Docker container.

docker run -it liquibase:4.33.0 sh
3

Do not exit out of this container. In a new terminal window, obtain the Container ID.

docker ps
4

Copy the Microsoft SQL Server 12.2.0 JAR file into the running container.

docker cp mssql-jdbc-12.2.0.jre11.jar <CONTAINER ID>:/liquibase/internal/lib
5

Create a new Docker image.

docker commit <CONTAINER ID> liquibase:4.33.0_w_mssql_12.2.0
6

Publish this custom Docker image internally.

Create a custom image with Docker - Liquibase