PowerCli, Docker And The Dollar Sign
You can execute vSphere's Powercli from your Linux box, without the need to run Windows. Beautiful, isn't it? And gets better: there is a docker image for that (reference). It's as easy as:
docker run --rm -it --entrypoint='/usr/bin/powershell' vmware/powerclicore
But then you create a docker-composer file and want to execute a cmdlet that has a dollar sign ($) diretcly Docker's entrypoint. Didn't find the solution on the web. Only by chance, and after few hours of trial and error, the beauty is revealed: have to double scape the dollar sign.
Turn this:
entrypoint: |
bash -c '/usr/bin/powershell <<EOF
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false
...
EOF'
Into this:
entrypoint: |
bash -c '/usr/bin/powershell <<EOF
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:\$$false
...
EOF'
(Issue reported on Docker PowerCli Github)
Comments
Post a Comment