Skip to content

Instantly share code, notes, and snippets.

@MegaMinxCoding
Created December 21, 2022 14:37
Show Gist options
  • Select an option

  • Save MegaMinxCoding/be832ae46dcab6cae0c4b3efb0696d80 to your computer and use it in GitHub Desktop.

Select an option

Save MegaMinxCoding/be832ae46dcab6cae0c4b3efb0696d80 to your computer and use it in GitHub Desktop.
Create Docker Secrets (on the underlying os)
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