{"record":{"id":"db5ee0ff01caa122","repo":"nektos/act","slug":"conflicting-options-cannot-specify-both-ip-and","errorCode":null,"errorMessage":"conflicting options: cannot specify both --ip and per-network IPv4 address","messagePattern":"conflicting options: cannot specify both --ip and per-network IPv4 address","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/container/docker_cli.go","lineNumber":826,"sourceCode":"\t\t}\n\t\tendpoints[n.Target] = ep\n\t}\n\tif hasUserDefined && hasNonUserDefined {\n\t\treturn nil, errors.New(\"conflicting options: cannot attach both user-defined and non-user-defined network-modes\")\n\t}\n\treturn endpoints, nil\n}\n\nfunc applyContainerOptions(n *opts.NetworkAttachmentOpts, copts *containerOptions) error { //nolint:gocyclo\n\t// 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`)?\n\tif len(n.Aliases) > 0 && copts.aliases.Len() > 0 {\n\t\treturn errors.New(\"conflicting options: cannot specify both --network-alias and per-network alias\")\n\t}\n\tif len(n.Links) > 0 && copts.links.Len() > 0 {\n\t\treturn errors.New(\"conflicting options: cannot specify both --link and per-network links\")\n\t}\n\tif n.IPv4Address.IsValid() && copts.ipv4Address != nil {\n\t\treturn errors.New(\"conflicting options: cannot specify both --ip and per-network IPv4 address\")\n\t}\n\tif n.IPv6Address.IsValid() && copts.ipv6Address != nil {\n\t\treturn errors.New(\"conflicting options: cannot specify both --ip6 and per-network IPv6 address\")\n\t}\n\tif n.MacAddress != \"\" && copts.macAddress != \"\" {\n\t\treturn errors.New(\"conflicting options: cannot specify both --mac-address and per-network MAC address\")\n\t}\n\tif len(n.LinkLocalIPs) > 0 && copts.linkLocalIPs.Len() > 0 {\n\t\treturn errors.New(\"conflicting options: cannot specify both --link-local-ip and per-network link-local IP addresses\")\n\t}\n\tif copts.aliases.Len() > 0 {\n\t\tn.Aliases = make([]string, copts.aliases.Len())\n\t\tcopy(n.Aliases, copts.aliases.GetSlice())\n\t}\n\t// For a user-defined network, \"--link\" is an endpoint option, it creates an alias. But,\n\t// for the default bridge it defines a legacy-link.\n\tif container.NetworkMode(n.Target).IsUserDefined() && copts.links.Len() > 0 {\n\t\tn.Links = make([]string, copts.links.Len())","sourceCodeStart":808,"sourceCodeEnd":844,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/container/docker_cli.go#L808-L844","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before: container command exits instantly, attach fails\njobs:\n  a: {runs-on: ubuntu-latest, container: alpine, steps: [{run: sleep 0}]}\n# after: keep it alive long enough or fix the real command\n  steps: [{run: echo ok}]","handlingStrategy":"validation","validationCode":"// Confirm container still running right before attach\nif c, _ := cli.ContainerInspect(ctx, id); !c.State.Running {\n\treturn fmt.Errorf(\"container exited early (code %d); see docker logs\", c.State.ExitCode)\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"failed to attach to container\") {\n\tlogs, _ := cli.ContainerLogs(ctx, id, client.ContainerLogsOptions{ShowStderr: true})\n\tdefer logs.Close() // read and surface why it exited\n}","preventionTips":["Ensure job container commands don't exit instantly","Use stable local sockets for streaming","Match act and Docker Engine versions"],"tags":["docker","attach","stream","container-lifecycle"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}