{"record":{"id":"ce45f985bea9333d","repo":"nektos/act","slug":"failed-to-create-job-container","errorCode":null,"errorMessage":"Failed to create job container","messagePattern":"Failed to create job container","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pkg/runner/run_context.go","lineNumber":414,"sourceCode":"\t\t\tWorkingDir:     ext.ToContainerPath(rc.Config.Workdir),\n\t\t\tImage:          image,\n\t\t\tUsername:       username,\n\t\t\tPassword:       password,\n\t\t\tName:           name,\n\t\t\tEnv:            envList,\n\t\t\tMounts:         mounts,\n\t\t\tNetworkMode:    jobContainerNetwork,\n\t\t\tNetworkAliases: []string{rc.Name},\n\t\t\tBinds:          binds,\n\t\t\tStdout:         logWriter,\n\t\t\tStderr:         logWriter,\n\t\t\tPrivileged:     rc.Config.Privileged,\n\t\t\tUsernsMode:     rc.Config.UsernsMode,\n\t\t\tPlatform:       rc.Config.ContainerArchitecture,\n\t\t\tOptions:        rc.options(ctx),\n\t\t})\n\t\tif rc.JobContainer == nil {\n\t\t\treturn errors.New(\"Failed to create job container\")\n\t\t}\n\n\t\treturn common.NewPipelineExecutor(\n\t\t\trc.pullServicesImages(rc.Config.ForcePull),\n\t\t\trc.JobContainer.Pull(rc.Config.ForcePull),\n\t\t\trc.stopJobContainer(),\n\t\t\tcontainer.NewDockerNetworkCreateExecutor(networkName).IfBool(createAndDeleteNetwork),\n\t\t\trc.startServiceContainers(networkName),\n\t\t\trc.JobContainer.Create(rc.Config.ContainerCapAdd, rc.Config.ContainerCapDrop),\n\t\t\trc.JobContainer.Start(false),\n\t\t\trc.JobContainer.Copy(rc.JobContainer.GetActPath()+\"/\", &container.FileEntry{\n\t\t\t\tName: \"workflow/event.json\",\n\t\t\t\tMode: 0o644,\n\t\t\t\tBody: rc.EventJSON,\n\t\t\t}, &container.FileEntry{\n\t\t\t\tName: \"workflow/envs.txt\",\n\t\t\t\tMode: 0o666,\n\t\t\t\tBody: \"\",","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/runner/run_context.go#L396-L432","documentation":"After calling container.NewContainer with the assembled job container configuration (network, aliases, binds, privileged/userns flags, platform, options), run_context.go checks whether the returned ExecutionsEnvironment is nil. With the real Docker implementation NewContainer practically never returns nil, but in Docker-less stub builds NewContainer is compiled to 'return nil', so any job that needs a job container immediately fails with 'Failed to create job container'.","triggerScenarios":"Running a workflow whose job uses a container or a non-self-hosted platform mapping under an act binary built with -tags WITHOUT_DOCKER or for an unsupported GOOS — NewContainer in docker_stub.go returns nil and this check fires during job startup.","commonSituations":"Distro or downstream act packages compiled without Docker; library users embedding act with the same build tags; expecting act --list to imply act can run containers (list works, execution does not); restricted sandboxes where Docker support was compiled out.","solutions":["Use an official act build that includes Docker support (linux/darwin/windows/netbsd, no WITHOUT_DOCKER tag).","Run the job on the host instead: act -P ubuntu-latest=-self-hosted, which skips job container creation.","Verify the binary: an act built Docker-less fails here for every containerized job — switch binaries rather than tweaking workflow options.","For library consumers, guard on build capabilities before invoking containerized runners."],"exampleFix":"# before\nact -j build   # job uses container: node:20, act built -tags WITHOUT_DOCKER\n# -> Failed to create job container\n\n# after\nact -P ubuntu-latest=-self-hosted -j build","handlingStrategy":"validation","validationCode":"// When embedding act: verify container support before containerized runs\npackage main\n\nimport (\n\t\"fmt\"\n\t\"os/exec\"\n)\n\nfunc canCreateJobContainers() error {\n\tif err := exec.Command(\"docker\", \"info\").Run(); err != nil {\n\t\treturn fmt.Errorf(\"docker unavailable; run jobs with -self-hosted instead of containers: %w\", err)\n\t}\n\treturn nil\n}","typeGuard":"func isNilJobContainer(rc *runner.RunContext) bool {\n    return rc.JobContainer == nil\n}","tryCatchPattern":"err := rc.JobExecutor()(ctx)\nif err != nil && strings.Contains(err.Error(), \"Failed to create job container\") {\n    return fmt.Errorf(\"act binary lacks docker support (stub NewContainer returned nil); use a docker-enabled build or -self-hosted platform mapping\")\n}","preventionTips":["Use official, Docker-enabled act builds for containerized jobs.","Map platforms to -self-hosted when Docker is unavailable.","Treat this error as an environment/build problem, not a workflow problem."],"tags":["build-tags","docker","container-creation","unsupported-platform"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}