Search code examples
dockerspring-cloud-dataflowspring-cloud-task

Deploying dockerized apps on Spring Cloud Data Flow server


Reading the documentation, it says:

Depending on the runtime, applications can be packaged in two ways:

Spring Boot uber-jar that is hosted in a maven repository, file, or HTTP(S).

Docker image.

So I made a docker image that runs a hello-world python program, and registered it on a local SCDF server.

app register --name hello-world --type task --uri docker:hello-world:latest

But when I try to launch it as a task, it fails

task create --name helloTask --definition "hello-world"

task launch helloTask 

Command failed org.springframework.cloud.dataflow.rest.client.DataFlowClientException: Exception trying to launch....resource = Docker Resource [docker:hello-world:latest]]

Do I need another server enviornment? Which one? The question is, is possible to use SCDF to run any dockerized application or it only accpets Spring Boot (java) ?

PS: my Dockerfile

FROM python:3.4-alpine
ADD . /code
WORKDIR /code
CMD python app.py

Solution

  • The Docker resolution is supported in local, cf and k8s server implementations of SCDF. However, each of the server variants has a particular way of supplying env-vars to the application at runtime. See Kubernetes-server docs for example.

    As for the application types, SCDF today orchestrates Spring Boot apps. SCDF cannot natively interpret other kinds of workloads.

    That said, if you intend to use python for stream processing, we provide a mechanism to run the Python scripts through the python-processor apps and at runtime, it would invoke the script from within the container. See a sample here.

    For Tasks specifically, we do not have a similar app, but it could be identical to what the python-processor(s) do, but with Spring Cloud Task programming model instead of Spring Cloud Stream. Perhaps you could try it out and contribute it back to the project.