'Add Flink Job Jar in Docker Setup and run Job via Flink Rest API

We're running Flink in Cluster Session mode and automatically add Jars in the Dockerfile:

ADD pipeline-fat.jar /opt/flink/usrlib/pipeline-fat.jar

So that we can run this Jar via the Flink Rest API without the need to upload the Jar in advance:

POST http://localhost:8081/:jarid/run

But the "static" Jar is now shown, to get the :jarid:

GET http://localhost:8081/jars

So my question is:

Is it possible to run a userlib jar using the Flink Rest API?

Or can you only reference such jars via

  • CLI flink run -d -c ${JOB_CLASS_NAME} /job.jar
  • and standalone-job --job-classname com.job.ClassName Mode?

My alternative approach (workaround) would be to upload the jar in the Docker entrypoint.sh of the jobmanager container:

curl -X POST http://localhost:8084/jars/upload \
    -H "Expect:" \
    -F "jarfile=@./pipeline-fat.jar"


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source