Public Repository

Last pushed: a year ago
Short Description
Migrate databases with Flyway 4.x in a small package!
Full Description


Full credit to jyore/flyway for the original image and Dockerfile. For our purposes, we needed 4.0 and the original was nearly 1GB in size which we thought was a bit too much (this image is ~8x smaller). Pretty much all documentation from that repo should apply to this one as well. We have included the absolutely necessary details here for convenience.

Configuring the Container to Perform Migrations

There are 2 mount points available for adding configuration and adding SQL migration files.These mount points are defined below:

  • /flyway/conf - Your flyway.conf file should get mounted here
  • /flyway/sql - Your .sql files should get mounted here

(The original image has a third mount option for jar migration files, but we do not use these so we have omitted them.)

Let's assume we have a project directory layout is as follows (pretty standard java/maven layout):

├── conf
|   └── flyway.conf
├── src
|   ├── main
|   |   ├── java
|   |   ├── resources
|   |   |   └── db
|   |   |       └── migration
|   |   |           ├── V1__initial.sql
|   |   |           ├── V2__addUserTable.sql
|   |   |           └── V3__updateUserTable.sql
|   |   └── webapp
|   └── test
└── pom.xml

Now we would run the docker container like so:

$ docker run --rm \
-v $PROJECT_HOME/conf:/flyway/conf \
-v $PROJECT_HOME/src/main/resources/db/migration:/flyway/sql \
-t easo/flyway

Assuming your flyway.conf file has all of your configuration information (see for more information) for making the database connections is correct, you should see your migrations start to run!

Overriding Commands

Any flyway command (or command options) can be run by the container by adding your information to the end of the run command. For example, let's say we want to get the info about our current migrations status and pending migrations. We can run the following:

$ docker run --rm -t easo/flyway info

This can be done with any of the main flyway commands migrate|clean|info|validate|baseline|repair. Please see flyway documentation at for more information

Docker Pull Command

Comments (0)