I was trying to create a Kubernetes (K8s) Secret, containing existing Docker credentials, as per this: -
and kept hitting syntax errors with the YAML.
For reference, in this scenario, we've already logged into a container registry, such as IBM Container Registry or Docker Hub, and want to grab the credentials that Docker itself "caches" in ~/.docker/config.json
Wait, what ? You didn't know that Docker helpfully does that ? Another good reason to NOT leave yourself logged into a container registry when you step away from your box ....
Anyhow, as per the above linked documentation, the trick is to encapsulate the content of that file, encoded using Base64, into a YAML file that looks something like this: -
<HERE'S THE BASE64 ENCODED STUFF>