Created
December 21, 2022 14:37
-
-
Save MegaMinxCoding/be832ae46dcab6cae0c4b3efb0696d80 to your computer and use it in GitHub Desktop.
Create Docker Secrets (on the underlying os)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| #avoid the character >"< in your passwords | |
| pwds = """ | |
| my-secret1: value1 | |
| my-secret2: value2 | |
| """.split("\n") | |
| for line in pwds: | |
| if not line: continue | |
| pwd = line.split(":", 1) | |
| label = pwd[0].strip() | |
| value = pwd[1].strip() | |
| print(f">>> Creating secret: {label}") | |
| os.system(f'echo "{value}" | docker secret create {label} -') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment