in builder/context.go [117:160]
func (b *Builder) getDockerRunArgsForStep(
volName string,
stepWorkDir string,
step *graph.Step,
entrypoint string,
cmd string) []string {
// Run user commands from a shell instance in order to mirror the shell's field splitting algorithms,
// so we don't have to write our own argv parser for exec.Command.
if runtime.GOOS == util.WindowsOS && step.Isolation == "" && !step.IsBuildStep() {
// Use hyperv isolation for non-build steps.
// Use default isolation for build step to improve performance. It assumes the docker-cli image is compatible with the host os.
step.Isolation = "hyperv"
}
if runtime.GOOS == util.WindowsOS && step.IsBuildStep() {
// Limit build command container cpu to 1
step.CPUS = "1"
}
var volMounts = make(map[string]string)
for _, mount := range step.Mounts {
volMounts[mount.Name] = mount.MountPath
}
return b.getDockerRunArgs(
volMounts,
volName,
stepWorkDir,
step.DisableWorkingDirectoryOverride,
!step.Keep,
step.Detach,
step.Envs,
step.Ports,
step.Expose,
step.Privileged,
step.User,
step.Network,
step.Isolation,
step.CPUS,
entrypoint,
step.ID,
cmd,
)
}