Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Sources/Services/ContainerAPIService/Client/Flags.swift
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,11 @@ public struct Flags {
)
public var virtualization: Bool = false

@Option(name: [.customLong("volume"), .short], help: "Bind mount a volume into the container")
@Option(
name: [.customLong("volume"), .short],
help:
"Bind mount a volume into the container. Formats: container-path (anonymous volume), name:container-path[:options], or host-path:container-path[:options], where options is a comma-separated list of mount options (e.g. ro)"
)
public var volumes: [String] = []

public func validate() throws {
Expand Down
4 changes: 2 additions & 2 deletions docs/command-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ container run [<options>] <image> [<arguments> ...]
* `--ssh`: Forward SSH agent socket to container
* `--shm-size <shm-size>`: Size of `/dev/shm` (e.g. 64M, 1G)
* `--tmpfs <tmpfs>`: Add a tmpfs mount to the container at the given path
* `-v, --volume <volume>`: Bind mount a volume into the container
* `-v, --volume <volume>`: Bind mount a volume into the container. Formats: `container-path` (anonymous volume), `name:container-path[:options]`, or `host-path:container-path[:options]`, where `options` is a comma-separated list of mount options (e.g. `ro`)
* `--virtualization`: Expose virtualization capabilities to the container (requires host and guest support)

**Registry Options**
Expand Down Expand Up @@ -245,7 +245,7 @@ container create [<options>] <image> [<arguments> ...]
* `--ssh`: Forward SSH agent socket to container
* `--shm-size <shm-size>`: Size of `/dev/shm` (e.g. 64M, 1G)
* `--tmpfs <tmpfs>`: Add a tmpfs mount to the container at the given path
* `-v, --volume <volume>`: Bind mount a volume into the container
* `-v, --volume <volume>`: Bind mount a volume into the container. Formats: `container-path` (anonymous volume), `name:container-path[:options]`, or `host-path:container-path[:options]`, where `options` is a comma-separated list of mount options (e.g. `ro`)
* `--virtualization`: Expose virtualization capabilities to the container (requires host and guest support)

**Registry Options**
Expand Down
10 changes: 10 additions & 0 deletions docs/how-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ total 4

The argument to `--volume` in the example consists of the full pathname for the host folder and the full pathname for the mount point in the container, separated by a colon.

You can append a third colon-separated component containing a comma-separated list of mount options. For example, use `ro` to make the mount read-only in the container:

<pre>
% container run --volume ${HOME}/Desktop/assets:/content/assets:ro docker.io/python:alpine touch /content/assets/test
touch: /content/assets/test: Read-only file system
</pre>

> [!NOTE]
> For host directory mounts, only the `ro` option is currently guaranteed to take effect. Other mount options, such as `nosuid`, are applied only when combined with `ro`; without `ro`, they are silently ignored.

The `--mount` option uses a comma-separated `key=value` syntax to achieve the same result:

<pre>
Expand Down