{"record":{"id":"cd54a2e3a24ac6dd","repo":"nektos/act","slug":"dryrun-is-not-supported-in-getcontainerarchive","errorCode":null,"errorMessage":"DRYRUN is not supported in GetContainerArchive","messagePattern":"DRYRUN is not supported in GetContainerArchive","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/container/docker_run.go","lineNumber":142,"sourceCode":"}\n\nfunc (cr *containerReference) CopyDir(destPath string, srcPath string, useGitIgnore bool) common.Executor {\n\treturn common.NewPipelineExecutor(\n\t\tcommon.NewInfoExecutor(\"%sdocker cp src=%s dst=%s\", logPrefix, srcPath, destPath),\n\t\tcr.copyDir(destPath, srcPath, useGitIgnore),\n\t\tfunc(ctx context.Context) error {\n\t\t\t// If this fails, then folders have wrong permissions on non root container\n\t\t\tif cr.UID != 0 || cr.GID != 0 {\n\t\t\t\t_ = cr.Exec([]string{\"chown\", \"-R\", fmt.Sprintf(\"%d:%d\", cr.UID, cr.GID), destPath}, nil, \"0\", \"\")(ctx)\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t).IfNot(common.Dryrun)\n}\n\nfunc (cr *containerReference) GetContainerArchive(ctx context.Context, srcPath string) (io.ReadCloser, error) {\n\tif common.Dryrun(ctx) {\n\t\treturn nil, fmt.Errorf(\"DRYRUN is not supported in GetContainerArchive\")\n\t}\n\tresult, err := cr.cli.CopyFromContainer(ctx, cr.id, client.CopyFromContainerOptions{SourcePath: srcPath})\n\treturn result.Content, err\n}\n\nfunc (cr *containerReference) UpdateFromEnv(srcPath string, env *map[string]string) common.Executor {\n\treturn parseEnvFile(cr, srcPath, env).IfNot(common.Dryrun)\n}\n\nfunc (cr *containerReference) UpdateFromImageEnv(env *map[string]string) common.Executor {\n\treturn cr.extractFromImageEnv(env).IfNot(common.Dryrun)\n}\n\nfunc (cr *containerReference) Exec(command []string, env map[string]string, user, workdir string) common.Executor {\n\treturn common.NewPipelineExecutor(\n\t\tcommon.NewInfoExecutor(\"%sdocker exec cmd=[%s] user=%s workdir=%s\", logPrefix, strings.Join(command, \" \"), user, workdir),\n\t\tcr.connect(),\n\t\tcr.find(),","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/container/docker_run.go#L124-L160","documentation":"GetContainerArchive copies a file or directory out of a running container via CopyFromContainer. Unlike the executor methods, it cannot be simulated: in dry-run mode (act -n sets the DRYRUN context flag) there is no real container to copy from, so it returns this error immediately.","triggerScenarios":"Calling container GetContainerArchive (e.g. artifact upload that fetches paths from the container, docker cp-style operations) while the context carries dryrun=true — running act with -n/--dryrun.","commonSituations":"Running act -n on workflows whose post steps or artifact steps try to retrieve files from the job container; library callers composing executors that assume dry-run is always a no-op returning nil.","solutions":["Re-run without -n/--dryrun when archive retrieval is needed","Guard the call site: skip archive-dependent logic when common.Dryrun(ctx) is true","If you maintain custom steps, make file-copy steps dry-run aware (check the flag before calling)"],"exampleFix":"// Go caller\nif !common.Dryrun(ctx) {\n    rc, err := cr.GetContainerArchive(ctx, srcPath)\n    ...\n}","handlingStrategy":"validation","validationCode":"// Go: check dry-run before requesting an archive\nif common.Dryrun(ctx) {\n    log.Debug(\"skipping archive fetch in dry-run\")\n    return nil\n}","typeGuard":"func shouldFetchArchive(ctx context.Context) bool { return !common.Dryrun(ctx) }","tryCatchPattern":null,"preventionTips":["Remember act -n cannot copy files from containers","Design custom steps to degrade gracefully in dry-run mode"],"tags":["docker","dryrun","container-archive","api-misuse"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}