1

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
anat0lius
  • 2,145
  • 6
  • 33
  • 60
  • I discovered that if I want to launch dockers I should use a native server (not a docker image as I was using) https://github.com/spring-cloud/spring-cloud-deployer-local/issues/61 – anat0lius Apr 04 '18 at 15:01
  • I can launch the task now, but this is the stderr.log error that generates `docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"--spring.cloud.task.executionid=3\": executable file not found in $PATH": unknown.` – anat0lius Apr 04 '18 at 15:02

2 Answers2

0

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.

Sabby Anandan
  • 5,636
  • 2
  • 12
  • 21
0

One way to invoke Python Docker image would create a Java processor and dockerize it with DinD-java as the base image. Then use Docker API inside this processor to invoke Python Docker image. This is explained here - https://dzone.com/articles/how-to-run-any-dockerized-application-on-spring-cl

randhir singh
  • 133
  • 1
  • 8