Flyway - CLI in Docker
Published: Flyway Estimated reading time: ~1 minutes
Flyway Tooling
To run flyway commands from docker, do the following.
docker run -it --rm --name flyway -v $PWD/flywayconf:/flywayconf flyway/flyway:7.11.0 --version
Instead of --version
use you own commands.
Note that if you need to point to any files, create them in the flywayconf
folder.
Any files you put into flywayconf
are referred to using the following syntax /flywayconf/myfile.conf
.
docker run -it --rm --name flyway -v $PWD/flywayconf:/flywayconf flyway/flyway:7.11.0 --version -configFiles=/flywayconf/deploy.conf -locations=/flywayconf/mysqlfiles $urlVar $additionalArguments -url="jdbc:snowflake://my.snowflakecomputing.com/?db=MY_DB&warehouse=MY_WH&role=MY_ROLE&authenticator=snowflake" -user=myUserName -password=myPassword
Playing around in the container
If you want to play around in the container to see where things are at, you can run the following command. When you are done, enter the command exit
.
docker run -it --rm --name flyway -v $PWD/flywayconf:/flywayconf --entrypoint /bin/bash flyway/flyway:7.11.0
For instance, if you want to know where the flyway command is
whereis flyway
Results in
flyway: /flyway/flyway.cmd /flyway/flyway
And any changes you make to your mapped files will be reflected on the host’s files as well.