16

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
  • 9,351
  • 10
  • 70
  • 110
phil swenson
  • 8,284
  • 20
  • 71
  • 96

2 Answers2

30

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
  • 23,476
  • 6
  • 70
  • 90
  • [`docker run` options](https://docs.docker.com/engine/reference/commandline/run/#options) – Matt Nov 16 '17 at 22:06
1

Without cat:

docker run -i mikegrass/gliderlabs_sigil-docker -p API_SERVER=$api_server_url < ./prometheus-configmap.yaml
rouble
  • 14,012
  • 16
  • 97
  • 97