nektos/act · error
conflicting options: cannot specify both --ip and per-networ
Error message
conflicting options: cannot specify both --ip and per-network IPv4 address
What it means
Error [95]: ContainerAttach (hijacked stream to the job container's stdout/stderr) failed in attach(). Act attaches after start to stream container output. Failure means the daemon refused the attach: container already exited, connection issue, or API incompatibility.
Source
Thrown at pkg/container/docker_cli.go:826
}
endpoints[n.Target] = ep
}
if hasUserDefined && hasNonUserDefined {
return nil, errors.New("conflicting options: cannot attach both user-defined and non-user-defined network-modes")
}
return endpoints, nil
}
func applyContainerOptions(n *opts.NetworkAttachmentOpts, copts *containerOptions) error { //nolint:gocyclo
// TODO should we error if _any_ advanced option is used? (i.e. forbid to combine advanced notation with the "old" flags (`--network-alias`, `--link`, `--ip`, `--ip6`)?
if len(n.Aliases) > 0 && copts.aliases.Len() > 0 {
return errors.New("conflicting options: cannot specify both --network-alias and per-network alias")
}
if len(n.Links) > 0 && copts.links.Len() > 0 {
return errors.New("conflicting options: cannot specify both --link and per-network links")
}
if n.IPv4Address.IsValid() && copts.ipv4Address != nil {
return errors.New("conflicting options: cannot specify both --ip and per-network IPv4 address")
}
if n.IPv6Address.IsValid() && copts.ipv6Address != nil {
return errors.New("conflicting options: cannot specify both --ip6 and per-network IPv6 address")
}
if n.MacAddress != "" && copts.macAddress != "" {
return errors.New("conflicting options: cannot specify both --mac-address and per-network MAC address")
}
if len(n.LinkLocalIPs) > 0 && copts.linkLocalIPs.Len() > 0 {
return errors.New("conflicting options: cannot specify both --link-local-ip and per-network link-local IP addresses")
}
if copts.aliases.Len() > 0 {
n.Aliases = make([]string, copts.aliases.Len())
copy(n.Aliases, copts.aliases.GetSlice())
}
// For a user-defined network, "--link" is an endpoint option, it creates an alias. But,
// for the default bridge it defines a legacy-link.
if container.NetworkMode(n.Target).IsUserDefined() && copts.links.Len() > 0 {
n.Links = make([]string, copts.links.Len())View on GitHub (pinned to 4f41128141)
Solutions
- docker logs <container> to see what the container printed before exiting; fix the entrypoint/workflow command
- Ensure daemon is up and stable: docker info
- Use a longer-running command/sleep in the container for debugging to confirm attach works
- Update Docker Engine / act to matching versions
Example fix
# before: container command exits instantly, attach fails
jobs:
a: {runs-on: ubuntu-latest, container: alpine, steps: [{run: sleep 0}]}
# after: keep it alive long enough or fix the real command
steps: [{run: echo ok}] Defensive patterns
Strategy: validation
Validate before calling
// Confirm container still running right before attach
if c, _ := cli.ContainerInspect(ctx, id); !c.State.Running {
return fmt.Errorf("container exited early (code %d); see docker logs", c.State.ExitCode)
} Try / catch
if err != nil && strings.Contains(err.Error(), "failed to attach to container") {
logs, _ := cli.ContainerLogs(ctx, id, client.ContainerLogsOptions{ShowStderr: true})
defer logs.Close() // read and surface why it exited
} Prevention
- Ensure job container commands don't exit instantly
- Use stable local sockets for streaming
- Match act and Docker Engine versions
When it happens
Trigger: cr.cli.ContainerAttach erroring: container exited before attach (fast-failing entrypoint), socket/tcp drop to daemon, or daemon too old for the attach options used.
Common situations: Job container whose command exits instantly; DOCKER_HOST remote with interrupted connections; Docker Desktop sleep/restart mid-run; attach racing container start on very short-lived containers.
Related errors
- --no-healthcheck conflicts with --health-* options
- --health-start-interval cannot be negative
- conflicting options: cannot specify both --link and per-netw
- conflicting options: cannot specify both --link-local-ip and
- valid streams are STDIN, STDOUT and STDERR
AI-assisted analysis of nektos/act@4f41128141 (2026-08-15).
Data as JSON: /api/errors/db5ee0ff01caa122.
Report an issue: GitHub.