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...
In general they are same as what you have mentioned and read in reference links for python. streams for receiving or reading input (stdin) and printing output (stdout). Example input from the keyboard or printing output to unix terminal. one reference here.
You have to use two combinations, one after the other: ctrl+p followed by ctrl+q. You turn interactive mode to daemon mode, which keeps the container running but frees up your terminal. You can attach to it later using docker attach, if you need to interact with the container more.
The docker exec and docker attach commands allow you to connect to a running container. To get an interactive shell to a container, use the exec command to start a new shell session. The attach command attaches your terminal to a running container.
To connect to a container using plain docker commands, you can use docker exec and docker attach . docker exec is a lot more popular because you can run a new command that allows you to spawn a new shell. You can check processes, files and operate like in your local environment.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With