错误:无效的参数:./wait-for-it.sh

时间:2018-08-24 10:33:46

标签: docker flyway

我有以下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

我怎么了?

1 个答案:

答案 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结尾。