Skip to content

Commit 5551e90

Browse files
docs: expand --mount section with detailed type descriptions (#25888)
Signed-off-by: codynguyen-dev <[email protected]>
1 parent 9146ef6 commit 5551e90

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

docs/source/markdown/podman-run.1.md.in

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,12 +647,83 @@ Using **--mount** flags to mount a host directory as a container folder, specify
647647
the absolute path to the directory or the volume name, and the absolute path
648648
within the container directory:
649649

650+
650651
````
651652
$ podman run --mount type=bind,src=/var/db,target=/data1 busybox sh
652653

653654
$ podman run --mount type=bind,src=volume-name,target=/data1 busybox sh
654655
````
655656

657+
The **--mount** flag provides a structured, key-value style for defining mounts
658+
inside containers. It is similar in purpose to **-v** or **--volume**, but offers
659+
greater clarity for complex or multi-option configurations. The general syntax
660+
is:
661+
662+
```
663+
--mount type=<TYPE>,src=<SOURCE>,dst=<TARGET>[,options...]
664+
```
665+
666+
Supported mount types include **bind**, **volume**, **tmpfs**, **artifact**,
667+
**devpts**, **image**, **glob**, and **ramfs**. Each type serves a different
668+
purpose in how data is attached to the container.
669+
670+
#### Bind mounts
671+
672+
Bind mounts directly link a directory or file on the host into the container.
673+
Changes made in one are immediately visible in the other. Use bind mounts when
674+
both the host and container need access to the same files, such as configuration
675+
files or source code.
676+
677+
Example:
678+
679+
```
680+
podman run --mount type=bind,src=/etc/config,dst=/app/config alpine cat /app/config/file.conf
681+
```
682+
683+
#### Volume mounts
684+
685+
Volume mounts use Podman-managed named volumes that persist independently of
686+
containers. They are ideal for persistent data such as databases or logs and are
687+
isolated from direct host paths.
688+
689+
Example:
690+
691+
```
692+
podman volume create mydata
693+
podman run --mount type=volume,src=mydata,dst=/var/lib/data postgres
694+
```
695+
696+
#### Tmpfs mounts
697+
698+
A tmpfs mount creates an in-memory filesystem on the host that is mounted inside
699+
the container. Data stored here is temporary and removed when the container
700+
stops or the host reboots. tmpfs mounts are useful for temporary caches or
701+
sensitive data that should not persist to disk.
702+
703+
Example:
704+
705+
```
706+
podman run --mount type=tmpfs,dst=/cache,tmpfs-size=64m alpine
707+
```
708+
709+
#### Artifact, devpts, image, glob, and ramfs mounts
710+
711+
Other specialized mount types are available for advanced use cases:
712+
713+
- **artifact** - Mounts read-only content from a container image or artifact.
714+
- **devpts** - Provides a pseudo-terminal device inside the container.
715+
- **image** - Mounts files directly from another container image.
716+
- **glob** - Mounts multiple host files matching a glob pattern.
717+
- **ramfs** - Similar to tmpfs but backed directly by system RAM without size limits.
718+
719+
These mount types are less commonly used and often appear in internal or
720+
advanced Podman workflows.
721+
722+
In summary, **--mount** provides a single consistent interface for connecting
723+
external storage to containers. Choose the mount type that best fits your use
724+
case: **bind** for direct host access, **volume** for persistent data managed by
725+
Podman, and **tmpfs** for ephemeral in-memory storage.
726+
656727
When using SELinux, be aware that the host has no knowledge of container SELinux
657728
policy. Therefore, in the above example, if SELinux policy is enforced, the
658729
_/var/db_ directory is not writable to the container. A "Permission Denied"

0 commit comments

Comments
 (0)