我有以下docker compose文件:
version: '3'
services:
my_sql_conatainer_name:
image: percona:latest
container_name: my_sql_conatainer_name
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: secret
ports:
- "3306:3306"
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
timeout: 20s
retries: 10
migration:
image: boxfuse/flyway:latest
container_name: flyway_migration
volumes:
- ./flyway_scripts/src/main/resources/db/migration:/flyway/sql
command: ["./wait-for-it.sh", "mysql:3306", "--", "migrate", "-url=jdbc:mysql://my_sql_conatainer_name:3306/secret?useUnicode=true&characterEncoding=utf8&useSSL=false", "-user=root", "-password=password"]
wait-for-it.sh
文件位于撰写文件附近
up
出现以下错误:
flyway_migration |错误:参数无效:./ wait-for-it.sh
我怎么了?
答案 0 :(得分:1)
Dockerfile for that image says:
ENTRYPOINT ["flyway"]
CMD ["-?"]
这两个部分串联在一起,您键入任何作为docker run
的参数的内容都只会替换CMD
部分。也就是说,实际上您正在运行flyway ./wait-for-it.sh ...
,而flyway
命令不知道该怎么做。
如果您想继续使用此路径,则可能最简单的下一步是将FROM boxfuse/flyway
的自定义映像COPY wait-for-it.sh
写入映像,然后添加自己的入口点脚本来执行{{ 1}}步骤并以wait-for-it
结尾。