Replies: 1 comment
-
I ended up abandoning using variables for docker labels and just hard coded them in the script. Didn't really see much benefit in using them as variables since they don't really change. Final script.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've written a custom bash deployment script to update multiple docker containers that use the same wildcard certificate. Each container has slighltly differing requirements for certificate location, format, certificate name, etc. To manage this I've assigned labels to the containers with the different configuration settings, which the script is meant to read and then apply to each individual container on a case by case basis.
What I'm finding is that the
$CERTTYPE_LABEL
variable which controls how the certificates are installed doesn't appear to be working.I generate the label using the following command:
CERTTYPE_LABEL=$(docker inspect --format='{{index .Config.Labels "$DEPLOY_DOCKERMULTI_CONTAINER_CERTTYPELABEL"}}' "$container_id")
When I try using this command from the shell, if returns a blank value. However, if I replace it with the actual string
sh.acme.autoload.certtype
instead of the variable$DEPLOY_DOCKERMULTI_CONTAINER_CERTTYPELABEL
it returns the correct value:CERTTYPE_LABEL=$(docker inspect --format='{{index .Config.Labels "sh.acme.autoload.certtype"}}' "$container_id")
I know I could just replace the variable with the actual value in the script, but was hoping keep the variable so it only needs to be modified in one spot should I ever need to change it.
Any suggestions as to what I'm doing wrong?
Full script is below:
Beta Was this translation helpful? Give feedback.
All reactions