23

I have a script that I want to use to use Sigil (based on Go's template engine) to populate template files

I'm using a dockerized sigil for this via:

docker run -v ${TEMPLATE_DIR}:/tmp/sigil mikegrass/gliderlabs_sigil-docker/sigil -f prometheus-configmap.yaml -p API_SERVER=$api_server_url > $TEMP_FILE

This seems a bit clunky with having to map a volume, so I'd rather use STDIN to pass in the file....

So what I'd like is

cat ./prometheus-configmap.yaml | docker run mikegrass/gliderlabs_sigil-docker -p API_SERVER=$api_server_url > $TEMP_FILE

Unfortunately this doesn't work, I get no output.

Googling around I see possible solutions but haven't gotten any to work...

030
  • 10,842
  • 12
  • 78
  • 123
phil swenson
  • 8,564
  • 20
  • 74
  • 99

2 Answers2

35

You need to run the container in interactive mode with --interactive or -i:

cat ./prometheus-configmap.yaml | docker run -i mikegrass/gliderlabs_sigil-docker -p API_SERVER=$api_server_url > $TEMP_FILE
Andy Shinn
  • 26,561
  • 8
  • 75
  • 93
  • [`docker run` options](https://docs.docker.com/engine/reference/commandline/run/#options) – Matt Nov 16 '17 at 22:06
2

Without cat:

docker run -i mikegrass/gliderlabs_sigil-docker -p API_SERVER=$api_server_url < ./prometheus-configmap.yaml
rouble
  • 16,364
  • 16
  • 107
  • 102