docker/cli ยท error

invalid value: %d. Valid memory swappiness range is 0-100

Error message

invalid value: %d. Valid memory swappiness range is 0-100

What it means

Error "invalid value: %d. Valid memory swappiness range is 0-100" thrown in docker/cli.

Source

Thrown at cli/command/container/opts.go:368

	if copts.macAddress != "" {
		if _, err := net.ParseMAC(strings.TrimSpace(copts.macAddress)); err != nil {
			return nil, fmt.Errorf("%s is not a valid mac address", copts.macAddress)
		}
	}
	if copts.stdin {
		attachStdin = true
	}
	// If -a is not set, attach to stdout and stderr
	if copts.attach.Len() == 0 {
		attachStdout = true
		attachStderr = true
	}

	var err error

	swappiness := copts.swappiness
	if swappiness != -1 && (swappiness < 0 || swappiness > 100) {
		return nil, fmt.Errorf("invalid value: %d. Valid memory swappiness range is 0-100", swappiness)
	}

	var binds []string
	volumes := copts.volumes.GetMap()
	// add any bind targets to the list of container volumes
	for bind := range volumes {
		parsed, err := volumespec.Parse(bind)
		if err != nil {
			return nil, err
		}

		if parsed.Source != "" {
			toBind := bind

			if parsed.Type == string(mount.TypeBind) {
				if hostPart, targetPath, ok := strings.Cut(bind, ":"); ok {
					if !filepath.IsAbs(hostPart) && strings.HasPrefix(hostPart, ".") {
						if absHostPart, err := filepath.Abs(hostPart); err == nil {

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at cli/command/container/opts.go:368 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/ad66a5bdf8cb6503.json. Report an issue: GitHub.