nektos/act · warning

DRYRUN is not supported in GetContainerArchive

Error message

DRYRUN is not supported in GetContainerArchive

What it means

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.

Source

Thrown at pkg/container/docker_run.go:142

}

func (cr *containerReference) CopyDir(destPath string, srcPath string, useGitIgnore bool) common.Executor {
	return common.NewPipelineExecutor(
		common.NewInfoExecutor("%sdocker cp src=%s dst=%s", logPrefix, srcPath, destPath),
		cr.copyDir(destPath, srcPath, useGitIgnore),
		func(ctx context.Context) error {
			// If this fails, then folders have wrong permissions on non root container
			if cr.UID != 0 || cr.GID != 0 {
				_ = cr.Exec([]string{"chown", "-R", fmt.Sprintf("%d:%d", cr.UID, cr.GID), destPath}, nil, "0", "")(ctx)
			}
			return nil
		},
	).IfNot(common.Dryrun)
}

func (cr *containerReference) GetContainerArchive(ctx context.Context, srcPath string) (io.ReadCloser, error) {
	if common.Dryrun(ctx) {
		return nil, fmt.Errorf("DRYRUN is not supported in GetContainerArchive")
	}
	result, err := cr.cli.CopyFromContainer(ctx, cr.id, client.CopyFromContainerOptions{SourcePath: srcPath})
	return result.Content, err
}

func (cr *containerReference) UpdateFromEnv(srcPath string, env *map[string]string) common.Executor {
	return parseEnvFile(cr, srcPath, env).IfNot(common.Dryrun)
}

func (cr *containerReference) UpdateFromImageEnv(env *map[string]string) common.Executor {
	return cr.extractFromImageEnv(env).IfNot(common.Dryrun)
}

func (cr *containerReference) Exec(command []string, env map[string]string, user, workdir string) common.Executor {
	return common.NewPipelineExecutor(
		common.NewInfoExecutor("%sdocker exec cmd=[%s] user=%s workdir=%s", logPrefix, strings.Join(command, " "), user, workdir),
		cr.connect(),
		cr.find(),

View on GitHub (pinned to 4f41128141)

Solutions

  1. Re-run without -n/--dryrun when archive retrieval is needed
  2. Guard the call site: skip archive-dependent logic when common.Dryrun(ctx) is true
  3. If you maintain custom steps, make file-copy steps dry-run aware (check the flag before calling)

Example fix

// Go caller
if !common.Dryrun(ctx) {
    rc, err := cr.GetContainerArchive(ctx, srcPath)
    ...
}
Defensive patterns

Strategy: validation

Validate before calling

// Go: check dry-run before requesting an archive
if common.Dryrun(ctx) {
    log.Debug("skipping archive fetch in dry-run")
    return nil
}

Type guard

func shouldFetchArchive(ctx context.Context) bool { return !common.Dryrun(ctx) }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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