[DEPRECATED] For Flyway 9 or newer, please use azure tags in https://hub.docker.com/r/flyway/flyway
This is the official repository for Flyway Command-line images.
There are two families of images:
For officially supported tags, please read the repository https://github.com/flyway/flyway-docker#supported-tags.
The flyway-azure image only supports alpine versions.
To make it easy to run Flyway the way you want to, the following volumes are supported:
| Volume | Usage |
|---|---|
/flyway/conf | Directory containing a flyway.conf configuration file |
/flyway/drivers | Directory containing the JDBC driver for your database |
/flyway/sql | The SQL files that you want Flyway to use (for SQL-based migrations) |
/flyway/jars | The jars files that you want Flyway to use (for Java-based migrations) |
You can switch between the various Flyway editions by setting the FLYWAY_EDITION environment variable to any of the following values:
| Value | Description |
|---|---|
community | Select the Flyway Community Edition (default) |
pro | Select the Flyway Pro (v6) Edition |
enterprise | Select the Flyway Enterprise (v6) / Teams (v7) Edition |
The easiest way to get started is simply to test the default image by running
docker run --rm flyway/flyway
This will give you Flyway Command-line's usage instructions.
To do anything useful however, you must pass the arguments that you need to the image. For example:
docker run --rm flyway/flyway -url=jdbc:h2:mem:test -user=sa info
Note that the syntax for flyway/flyway-azure is slightly different in order to be compatible with Azure Pipelines
agent job requirements. As it does not define an entrypoint, you need to explicitly add the flyway command. For example:
docker run --rm flyway/flyway-azure:latest-alpine flyway
To add your own SQL files, place them in a directory and mount it as the flyway/sql volume.
Create a new directory and add a file named V1__Initial.sql with following contents:
CREATE TABLE MyTable ( MyColumn VARCHAR(100) NOT NULL );
Now run the image with the volume mapped:
docker run --rm -v /absolute/path/to/my/sqldir:/flyway/sql flyway/flyway -url=jdbc:h2:mem:test -user=sa migrate
If you prefer to store those arguments in a config file you can also do so using the flyway/conf volume.
Create a file named flyway.conf with the following contents:
flyway.url=jdbc:h2:mem:test flyway.user=sa
Now run the image with that volume mapped as well:
docker run --rm -v /absolute/path/to/my/sqldir:/flyway/sql -v /absolute/path/to/my/confdir:/flyway/conf flyway/flyway migrate
Flyway ships by default with drivers for
If your database is not in this list, or if you want to ship a different or newer driver than the one included you can do so using the flyway/drivers volume.
Create a directory and drop for example the Oracle JDBC driver (ojdbc8.jar) in there.
You can now let Flyway make use of it my mapping that volume as well:
docker run --rm -v /absolute/path/to/my/sqldir:/flyway/sql -v /absolute/path/to/my/confdir:/flyway/conf -v /absolute/path/to/my/driverdir:/flyway/drivers flyway/flyway migrate
To pass in Java-based migrations and callbacks you can use the flyway/jars volume.
Create a directory and drop for a jar with your Java-based migrations in there.
You can now let Flyway make use of it my mapping that volume as well:
docker run --rm -v /absolute/path/to/my/sqldir:/flyway/sql -v /absolute/path/to/my/confdir:/flyway/conf -v /absolute/path/to/my/jardir:/flyway/jars flyway/flyway migrate
To run both Flyway and the database that will be migrated in containers, you can use a docker-compose.yml file that
starts and links both containers.
version: '3' services: flyway: image: flyway/flyway command: -url=jdbc:mysql://db -schemas=myschema -user=root -password=P@ssw0rd -connectRetries=60 migrate volumes: - .:/flyway/sql depends_on: - db db: image: mysql environment: - MYSQL_ROOT_PASSWORD=P@ssw0rd command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci ports: - 3306:3306
Run docker-compose up, this will start both Flyway and MySQL. Flyway will automatically wait for up to one minute for MySQL to be initialized before it begins to migrate the database.
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
不支持 push
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务