

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 可用的运行时
<a name="available-runtimes"></a>

您可以在 buildspec 文件的 `runtime-versions` 部分中指定一个或多个运行时。如果您的运行时依赖于另一个运行时，您还可以在 buildspec 文件中指定其依赖运行时。如果您未在 buildspec 文件中指定任何运行时，请 CodeBuild 选择您使用的映像中可用的默认运行时。如果指定一个或多个运行时，则仅 CodeBuild 使用这些运行时。如果未指定依赖运行时，则 CodeBuild 会尝试为您选择依赖运行时。

**注意**  
如果未指定运行时版本，则 CodeBuild 使用默认版本。当先前的默认版本达到使用寿命终止 (EOL) 时，默认版本可能会发生变化。为避免对构建环境进行意外更改，我们建议在 buildspec 文件中指定运行时版本。

 有关更多信息，请参阅 [Specify runtime versions in the buildspec file](build-spec-ref.md#runtime-versions-buildspec-file)。

[Specify runtime versions in the buildspec file](build-spec-ref.md#runtime-versions-buildspec-file).

.

**Topics**
+ [Linux 映像运行时](#linux-runtimes)
+ [macOS 映像运行时](#macOS-runtimes)
+ [Windows 映像运行时](#windows-runtimes)

## Linux 映像运行时
<a name="linux-runtimes"></a>

下表包含可用的运行时和支持这些运行时的标准 Linux 映像。


**Ubuntu 和 Amazon Linux 平台运行时系统**  
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/codebuild/latest/userguide/available-runtimes.html)

## macOS 映像运行时
<a name="macOS-runtimes"></a>

**重要**  
Mac 版本的 CodeBuild 精选映像包含预装的 macOS 和 Xcode。使用 Xcode 软件，即表示您承认、理解并同意 [Xcode 和 Apple SDKs 协议](https://www.apple.com/legal/sla/docs/xcode.pdf)。如果您不接受协议的条款和条件，请不要使用 Xcode 软件。请改为提供您自己的亚马逊机器映像（AMI）。有关更多信息，请参阅 [如何配置 macOS 预留容量实例集？](fleets.md#fleets.configure-macos)。

下表包含 macOS 支持的可用运行时。


**macOS 平台运行时**  
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/codebuild/latest/userguide/available-runtimes.html)

## Windows 映像运行时
<a name="windows-runtimes"></a>

Windows Server Core 2019 的基本映像包含以下运行时。


**Windows 平台运行时**  

| 运行时名称 | Windows Server Core 2019 标准版：1.0 版本 | Windows Server Core 2019 标准版：2.0 版本 | Windows Server Core 2019 标准版：3.0 版本 | 
| --- | --- | --- | --- | 
| dotnet | 3.15.0 | 3.16.07.0 | 8.0 | 
| dotnet sdk | 3.15.0 | 3.16.07.0 | 8.0 | 
| golang | 1.14 | 1.18 | 1.211.221.23 | 
| gradle | 6.7 | 7.6 | 8.12 | 
| java | Corretto11 | Corretto11Corretto17 | Corretto8Corretto11Corretto17Corretto21 | 
| maven | 3.6 | 3.8 | 3.9 | 
| nodejs | 14.15 | 16.19 | 20.1822.13 | 
| php | 7.4 | 8.1 | 8.38.4 | 
| PowerShell | 7.1 | 7.2 | 7.4 | 
| python | 3.8 | 3.10 | 3.103.113.123.13 | 
| ruby | 2.7 | 3.1 | 3.23.33.4 | 