docker/cli · error
unknown option ' ' in
Error message
unknown option '%s' in '%s'
What it means
Returned by MountOpt.Set (opts/mount.go:140) when a mount option key matches none of the recognized cases. The key (lowercased) is switched against the full known set (type, source/src, target/dst/destination, readonly/ro, consistency, bind-propagation, bind-recursive, bind-create-src, volume-subpath, volume-nocopy, volume-label, volume-driver, volume-opt, image-subpath, tmpfs-size, tmpfs-mode); anything else falls to default and is rejected.
Solutions
- Check the spelling against the supported mount options and use aliases (src for source, dst/destination for target).
- Confirm the option exists in your CLI version — newer daemon options may not be parsed yet.
- Remove the unsupported field; some options belong in the daemon config, not the mount spec.
Example fix
// before --mount "type=bind,src=/data,dest=/data,read-only=true" // after --mount "type=bind,source=/data,target=/data,readonly"
Defensive patterns
Strategy: validation
Validate before calling
var knownMountKeys = map[string]bool{
"type": true, "source": true, "src": true, "target": true, "dst": true, "destination": true,
"readonly": true, "ro": true, "consistency": true, "bind-propagation": true, "bind-recursive": true,
"bind-create-src": true, "volume-subpath": true, "volume-nocopy": true, "volume-label": true,
"volume-driver": true, "volume-opt": true, "image-subpath": true, "tmpfs-size": true, "tmpfs-mode": true,
}
func validateKnownKeys(spec string) error {
r := csv.NewReader(strings.NewReader(spec))
fields, err := r.Read()
if err != nil {
return err
}
for _, f := range fields {
k, _, _ := strings.Cut(f, "=")
if !knownMountKeys[strings.ToLower(k)] {
return fmt.Errorf("unknown mount option %q", k)
}
}
return nil
} Try / catch
if err := m.Set(spec); err != nil {
return fmt.Errorf("mount %q: %w", spec, err)
} Prevention
- Build mounts from a typed struct and only emit known keys.
- Check the CLI version supports an option before emitting it.
- Use canonical aliases consistently (source/target).
When it happens
Trigger: Passing a typo or unsupported option: `src`, `destintion`, `read-only`, `volume-copy`, `tmpfs-uid`, `propagation`, or an Engine version's option not implemented by this CLI version.
Common situations: Misspelling an option name, using a hyphen vs underscore mismatch, or referencing a daemon option that the CLI opts layer does not surface.
Related errors
- invalid value for ' ': value is empty
- invalid value for ' ' in ' ': value should not have…
- invalid field ' ' must be a key=value pair
- invalid value for : (must be "enabled", "disabled"…
- invalid value for
AI-assisted analysis of docker/cli@4f84911bfe (2026-08-07).
Data as JSON: /api/errors/1cf678e518d54c68.
Report an issue: GitHub.
Appendix: source
Thrown at opts/mount.go:140
case "volume-opt":
volumeDriver := ensureVolumeDriver(&mount)
volumeDriver.Options = setValueOnMap(volumeDriver.Options, val)
case "image-subpath":
ensureImageOptions(&mount).Subpath = val
case "tmpfs-size":
sizeBytes, err := units.RAMInBytes(val)
if err != nil {
return fmt.Errorf("invalid value for %s: %s", key, val)
}
ensureTmpfsOptions(&mount).SizeBytes = sizeBytes
case "tmpfs-mode":
ui64, err := strconv.ParseUint(val, 8, 32)
if err != nil {
return fmt.Errorf("invalid value for %s: %s", key, val)
}
ensureTmpfsOptions(&mount).Mode = os.FileMode(ui64)
default:
return fmt.Errorf("unknown option '%s' in '%s'", key, field)
}
}
if err := validateMountOptions(&mount); err != nil {
return err
}
m.values = append(m.values, mount)
return nil
}
// Type returns the type of this option
func (*MountOpt) Type() string {
return "mount"
}
// String returns a string repr of this option
func (m *MountOpt) String() string {View on GitHub (pinned to 4f84911bfe)