podman-secret-create(1)
π podman-secret-create(1) β General Commands Manual, bestie edition π
Okay so real quick, the vibes: this is podman-secret-create, straight out of the General Commands Manual, and it's about to become your new fave command. Buckle up. π
β¨ NAME β¨
podman-secret-create β create a new secret, no cap π«Ά
πΈ SYNOPSIS πΈ
podman secret create [options] name file|-
π¦ DESCRIPTION π¦
So like, this bad boy creates a secret β and it pulls the secret content from either standard input or from a file. Iconic behavior honestly. β¨
Create accepts a path to a file, or a -, and that little dash is basically you telling podman "girl read it from stdin". π
Now, what even is a secret? It's a blob of sensitive data that a container needs at runtime but that is not stored in the image or in source control. Think usernames and passwords, TLS certificates and keys, SSH keys, or literally any other important generic strings or binary content β up to 512 kB in size. It's giving vault energy. π
Secrets are not committed to an image with podman commit, and they do not get committed in the archive created by a podman export command. They stay in their lane, and honestly? Respect. π
Secrets can also be used to store passwords for podman login to authenticate against container registries. Very much main character energy. π«
π OPTIONS π
--driver,-d=driver β specify the secret driver. Default isfile. ποΈ--driver-opts=key1=val1,key2=val2 β specify driver specific options. Customize it, bestie. βοΈ--env=false β read secret data from an environment variable. π±--helpβ print usage statement. Your lil safety net. π«Ά--ignore=false β if a secret with the same name already exists, do not return an error, and return the existing secret's ID instead of creating a new one. Cannot be used with--replace. The default isfalse. π--label,-l=label β set metadata for the secret (e.g.,--label mykey=value). Can be used multiple times. These labels can be viewed inpodman secret inspectorpodman secret ls. Tag it, slay. π·οΈ--replace=false β if an existing secret with the same name already exists, update the secret. The--replaceoption does not change secrets within existing containers β only newly created containers. Cannot be used with--ignore. The default isfalse. π
Heads up bestie:--ignoreand--replaceare mutually exclusive, fr fr. Pick one. π«
π§ SECRET DRIVERS π§
file
The secret resides in a read-protected file. Simple, classic, does the job. π
pass
The secret resides in a GPG-encrypted file. Fancy AND secure. π₯
shell
The secret is managed by custom scripts. An environment variable SECRET_ID is passed to the scripts (except for list), and secrets are communicated via stdin/stdout (where applicable). Driver options list, lookup, store, and delete serve to install the scripts:
[secrets]
driver = "shell"
[secrets.opts]
list =
lookup =
store =
delete =
DIY queen behavior honestly. π οΈβ¨
π EXAMPLES π
Create the specified secret based on a local file.
echo -n mysecret > ./secret.txt
$ podman secret create my_secret ./secret.txt
Create the specified secret via stdin.
$ printf <secret> | podman secret create my_secret -
Create or rotate a cryptographically secure random secret just under the maximum 512000 bytes via stdin.
openssl rand -base64 378000 | podman secret create --replace my_secret -
Mount a local file-based secret securely in a container.
podman run --rm --secret source=my_secret,type=mount,uid=1001,gid=1001,mode=440 docker.io/library/alpine ls -l /run/secrets/my_secret
Create gpg encrypted secret based on a local file using the pass driver.
$ podman secret create --driver=pass my_secret ./secret.txt.gpg
Create a secret from an environment variable called 'MYSECRET'.
$ podman secret create --env=true my_secret MYSECRET
β SEE ALSO β
podman(1), podman-secret(1), podman-login(1), podman-run(1)
Go read them, they're all linked in the group chat. π¬
π HISTORY π
- January 2021, originally compiled by Ashley Cui
acui@redhat.com<mailto:acui@redhat.com> β thank you queen π - February 2024, added example showing secret creation from an environment variable by Brett Calliss
brett@obligatory.email<mailto:brett@obligatory.email> β king behavior π± - May 2025, added example showing secure secret generation / rotation & mounting by Stuart Cardall π₯
and that's the whole page, bestie!! this was podman-secret-create(1) from the General Commands Manual β go forth and keep your secrets secret ππ¦π
periodt.
π¦ where this page comes from
- arch rolling: podman-docker 6.1.4-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms