My Tomcat Container needs data that has to be well protected, i.e. passwords for database access and certificates and keys for Single Sign On t
Mount the encrypted keys into container, then pass the password via pipe. The difficulty comes with the detach
mode, which will hang while reading the pipe within the container. Here is a trick to work around:
cid=$(docker run -d -i alpine sh -c 'read A; echo "[$A]"; exec some-server')
docker exec -i $cid sh -c 'cat > /proc/1/fd/0' <<< _a_secret_
First, create the docker daemon with -i
option, the command read A
will hang waiting for the input from /proc/1/fd/0
;
Then run the second docker command, reading the secret from stdin and redirect to the last hanging process.