Public | Automated Build

Last pushed: 3 years ago
Short Description
Execute bash scripts via a REST interface
Full Description


Lets you execute bash scripts located in /scripts via a REST interface.
Does some basic escape character removal, but only trust it from internal source.

Name the script with the request method first:

You can use directories:

Contains some example scripts: - plain old helloworld that prints the input parameter. - prints the environment variables that was set when the script runs. - example of using jq to parse JSON input - counting to 10 with 1s sleep in each step.
shows how the streaming log output works

Execute script:

$ curl -d '{"args": "some_parameter"}'
Hello, World. You sent in: some_parameter

Add extra environment variables, will be prepended with REST_:

$ curl -d '{"args": "", "key":"value"}'

Using jq ( to parse JSON input:

$ curl -d '{"args": "", "key":"value"}'
 "key": "value",
 "args": ""

Build docker container with your own scripts based on this:

$ cat >Dockerfile <<EOF
FROM larsla/bash2rest
ADD my_scripts /scripts
VOLUME /logs
CMD /usr/bin/python /bash2rest/
$ docker build -t my_bash2rest .
Docker Pull Command
Source Repository