nektos/act · error

--uts: invalid UTS mode

Error message

--uts: invalid UTS mode

What it means

Error [82]: Docker daemon API ContainerCreate call failed after act assembled Config/HostConfig/NetworkingConfig/Platform. The wrapped error comes from the daemon: bad image reference, name conflict, invalid host config (bad mount/bind/cap), platform not available, or API version mismatch. Act had already pulled/inspected the image, so this is about container creation specifically.

Source

Thrown at pkg/container/docker_cli.go:532

	envVariables, err := opts.ReadKVEnvStrings(copts.envFile.GetSlice(), copts.env.GetSlice())
	if err != nil {
		return nil, err
	}

	// collect all the labels for the container
	labels, err := opts.ReadKVStrings(copts.labelsFile.GetSlice(), copts.labels.GetSlice())
	if err != nil {
		return nil, err
	}

	pidMode := container.PidMode(copts.pidMode)
	if !pidMode.Valid() {
		return nil, errors.New("--pid: invalid PID mode")
	}

	utsMode := container.UTSMode(copts.utsMode)
	if !utsMode.Valid() {
		return nil, errors.New("--uts: invalid UTS mode")
	}

	usernsMode := container.UsernsMode(copts.usernsMode)
	if !usernsMode.Valid() {
		return nil, errors.New("--userns: invalid USER mode")
	}

	cgroupnsMode := container.CgroupnsMode(copts.cgroupnsMode)
	if !cgroupnsMode.Valid() {
		return nil, errors.New("--cgroupns: invalid CGROUP mode")
	}

	restartPolicy, err := opts.ParseRestartPolicy(copts.restartPolicy)
	if err != nil {
		return nil, err
	}

	loggingOpts, err := parseLoggingOpts(copts.loggingDriver, copts.loggingOpts.GetSlice())

View on GitHub (pinned to 4f41128141)

Solutions

  1. Run 'docker ps -a' and remove leftover act containers: docker rm -f $(docker ps -aq --filter name=act-)
  2. Check the wrapped daemon message — it names the exact offending field (bind, cap, name, platform)
  3. Verify bind source paths exist on the host; create them or fix absolute paths
  4. Upgrade the Docker daemon (or set DOCKER_API_VERSION) so daemon matches the moby client act uses
  5. Re-run with act -v to see the merged HostConfig logged right before creation

Example fix

# before: leftover container blocks create
$ docker ps -a --filter name=act-job
# after
$ docker rm -f act-job
$ act -j job
Defensive patterns

Strategy: try-catch

Validate before calling

// Before running act: ensure no name conflicts
// docker ps -a --filter name=act- ; remove leftovers

Try / catch

if err := containerRun(ctx); err != nil {
	if strings.Contains(err.Error(), "failed to create container") {
		// daemon message is wrapped after the colon; surface it and clean up
		_ = cli.ContainerRemove(ctx, name, client.ContainerRemoveOptions{Force: true})
	}
	return err
}

Prevention

When it happens

Trigger: cr.cli.ContainerCreate returning non-nil: container name already in use (--name or job container name collision), invalid bind-mount source path, unknown capability in CapAdd/CapDrop, invalid platform spec, or daemon API version older than the client library expects.

Common situations: A previous act run left a stopped container with the same name (crashed runs don't always clean up; run 'docker ps -a | grep act-'); binding a host path that doesn't exist; using network/cap flags not supported by old Docker on CI; Docker Desktop freshly restarted and temporary state lost.

Related errors


AI-assisted analysis of nektos/act@4f41128141 (2026-08-15). Data as JSON: /api/errors/0f70b2f33ee83809. Report an issue: GitHub.