我正在努力将 cron 表达式 0 */1 * ?* * * 到 docker-compose.yml 作为环境变量..
我试图用反斜杠转义*,还有“和”,但没有运气。
cont1:
image: some-image
restart: unless-stopped
volumes:
- some_volume
environment:
- JAVA_OPTS=
-Dserver.port=${DP_PORT:-8080}
-Ddoc.office.viaFile=true
-DdocumentCache.cleanUp.cron.timer='0 */1 * ? * * *'
YAML 解析器的输出:
{
"cont1": {
"environment": [
"JAVA_OPTS= -Dserver.port=${DP_PORT:-8080} -Ddoc.office.viaFile=true -DdocumentCache.cleanUp.cron.timer='0 */1 * ? * * *'"
],
"image": "some-image",
"restart": "unless-stopped",
"volumes": [
"some-image"
]
}
}
YAML 有效.. docker-compose 出错:
Error: Could not find or load main class proc.1
Caused by: java.lang.ClassNotFoundException: proc.1