1

I am struggling to put cron expression 0 */1 * ? * * * into docker-compose.yml as environment variable..

I tried to escape * with backslash, also " and ', but no luck.

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 * ? * * *'

Output from YAML parser:

{
  "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 is valid.. Error by docker-compose:

Error: Could not find or load main class proc.1
Caused by: java.lang.ClassNotFoundException: proc.1

1 Answers1

0

Try putting your YAML in an online YAML editor, like this one: https://yaml-online-parser.appspot.com/ and see what output it produces, and whether it's an output you expect.

Danon
  • 2,771
  • 27
  • 37
  • I tried yml validator and it is valid yml, but still docker compose has a problem with these star and space characters. Error: Could not find or load main class proc.1 Caused by: java.lang.ClassNotFoundException: proc.1 – mrondrejduchon Jul 08 '21 at 12:01