docker/compose · error

compacting json for seccomp profile (%s) failed: %w

Error message

compacting json for seccomp profile (%s) failed: %w

What it means

Error "compacting json for seccomp profile (%s) failed: %w" thrown in docker/compose.

Source

Thrown at pkg/compose/create.go:581

			unconfined = true
			continue
		}
		con := strings.SplitN(opt, "=", 2)
		if len(con) == 1 && con[0] != "no-new-privileges" {
			if strings.Contains(opt, ":") {
				con = strings.SplitN(opt, ":", 2)
			} else {
				return securityOpts, false, fmt.Errorf("invalid security-opt: %q", opt)
			}
		}
		if con[0] == "seccomp" && con[1] != "unconfined" && con[1] != "builtin" {
			f, err := os.ReadFile(p.RelativePath(con[1]))
			if err != nil {
				return securityOpts, false, fmt.Errorf("opening seccomp profile (%s) failed: %w", con[1], err)
			}
			b := bytes.NewBuffer(nil)
			if err := json.Compact(b, f); err != nil {
				return securityOpts, false, fmt.Errorf("compacting json for seccomp profile (%s) failed: %w", con[1], err)
			}
			parsed = append(parsed, fmt.Sprintf("seccomp=%s", b.Bytes()))
		} else {
			parsed = append(parsed, opt)
		}
	}

	return parsed, unconfined, nil
}

// defaultNetworkSettings determines the container.NetworkMode and corresponding network.NetworkingConfig (nil if not applicable).
func defaultNetworkSettings(project *types.Project,
	service types.ServiceConfig, serviceIndex int,
	links []string, useNetworkAliases bool,
	version string,
) (container.NetworkMode, *network.NetworkingConfig, error) {
	if service.NetworkMode != "" {
		return container.NetworkMode(service.NetworkMode), nil, nil

View on GitHub (pinned to ddc4b044b6)

Solutions

  1. Validate the seccomp profile file is well-formed JSON (e.g. with jq) and fix any syntax errors.

When it happens

Trigger: The seccomp profile file was read but its content is not valid JSON, so it cannot be compacted and passed to the engine.

Common situations: The seccomp profile contains syntax errors, trailing commas, or is not a JSON document at all.


AI-assisted analysis of docker/compose@ddc4b044b6 (2026-08-15). Data as JSON: /api/errors/61d491ac3d718c1d. Report an issue: GitHub.