Finch 是一个用于容器开发的开源客户端。其简单的安装程序提供了一个最小的本机客户端以及其他开源组件的固执己见的分发。 Finch 并没有创造更多的选项来推理和选择,而是旨在通过简化安装和使用其他项目来帮助推广它们,同时提供一个简单的本机客户端将它们连接在一起。
Finch 提供了一个与 nerdctl 集成的简单客户端。对于核心构建/运行/推/拉命令,Finch 依靠 nerdctl 来处理繁重的工作。它与containerd一起进行容器管理,并与BuildKit一起处理开放容器计划(OCI)图像构建。这些组件全部整合在一起并在 Lima 管理的虚拟机中运行。
借助 Finch,您可以利用这些现有项目,而无需追究所有细节。只需安装并开始运行和构建您的容器!
该项目将在不久的将来拥有更完整的文档和教程。现在让我们从这里开始。如上所述, finch
与nerdctl
集成。虽然 Finch 没有实现 100% 的上游命令,但最常见的命令已经就位并正在运行。 nerdctl 命令参考可以作为文档的起点。
要在 macOS 上开始使用 Finch,先决条件是:
从项目的 GitHub 发布页面下载适合您的架构的发布包,下载后双击并按照说明进行操作。
brew install --cask finch
要在 Windows 上开始使用 Finch,先决条件是:
wsl --install
)从项目的 GitHub 发布页面下载 MSI 安装程序,下载后双击并按照说明进行操作。
安装完成后,需要执行一次finch vm init
来设置底层系统。此初始设置通常需要大约一分钟。
finch vm init
INFO[0000] Initializing and starting Finch virtual machine...
..
INFO[0067] Finch virtual machine started successfully
要在 Linux 上开始使用 Finch,先决条件是:
目前,Finch 安装程序在 Amazon Linux 上打包和分发。如果您不使用 Amazon Linux,则可以从 GitHub 版本页面下载二进制文件并按照 finch.spec 文件中的约定安装/配置依赖项。详细说明可在 runfinch.com 上找到。
您现在可以运行测试容器。如果您熟悉容器开发,则可以按预期使用run
命令。
finch run --rm public.ecr.aws/finch/hello-finch
如果您是容器新手,那真是太令人兴奋了!安装并初始化 Finch 后尝试上面的命令。 run
命令会在本地提取映像(如果尚不存在),然后为您创建并运行容器。请注意,方便的--rm
选项将在执行完成后删除容器实例。
要构建图像,请尝试使用 finch 客户端存储库中的快速示例。
git clone https://github.com/runfinch/finch.git
cd finch/contrib/hello-finch
finch build . -t hello-finch
..
同样,如果您是容器新手,那么您刚刚构建了一个容器映像。好的!
build
命令将与构建系统(Finch 中的 Moby 项目的 BuildKit)配合使用,从 Dockerfile 创建 OCI 映像,这是创建映像的一种特殊方法。然后可以使用该映像来创建容器。您可以使用finch images
命令查看本地拉取和构建的图像。
Finch 使用--platform
选项可以轻松跨架构构建和运行容器。当与run
命令一起使用时,它将使用指定的架构创建一个容器。例如,在 Apple Silicon M1 系统上, --platform=amd64
将创建一个容器并使用 x86-64 架构在其中运行进程。
uname -ms
Darwin arm64
finch run --rm --platform=amd64 public.ecr.aws/amazonlinux/amazonlinux uname -ms
Linux x86_64
您还可以在构建中使用--platform
选项,从而轻松创建多平台映像。
我们计划在这里为容器新手用户创建更多文档和教程,并为更高级的用户提供一些提示和技巧。现在,如果您准备好踢轮胎,请这样做!您会发现其他工具中提供的大多数您熟悉的命令和选项,正如您所期望的那样(或者,正如它们在 nerdctl 上游记录的那样)。涵盖了我们每天使用的大部分命令,包括卷和网络管理以及 Compose 支持。如果 Finch 没有做您想要做的事情,请考虑提出问题或拉取请求。
安装程序将在系统中自己的区域中安装 Finch 及其依赖项,并且它可以与其他容器开发工具愉快地共存。 Finch 是一个新项目,并不意味着可以直接替代其他工具。因此,我们不建议使用别名或将其他命令名称链接到finch
。
Finch 具有简单且可扩展的配置。
首次运行时将生成位于${HOME}/.finch/finch.yaml
的配置文件。目前,此配置文件具有底层虚拟机的系统资源限制选项。这些默认限制是根据主机系统上可用的资源动态生成的,但可以通过手动编辑配置文件来更改。
有关配置选项的完整列表,请检查 macOS 的 finch 结构。
finch.yaml
示例如下所示:
# cpus: the amount of vCPU to dedicate to the virtual machine. (required)
cpus : 4
# memory: the amount of memory to dedicate to the virtual machine. (required)
memory : 4GiB
# snapshotters: the snapshotters a user wants to use (the first snapshotter will be set as the default snapshotter)
# Supported Snapshotters List:
# - soci https://github.com/awslabs/soci-snapshotter/tree/main
# Once the option has been set the snapshotters will be installed on either finch vm init or finch vm start.
# The snapshotters binary will be downloaded on the virtual machine and will be configured and ready for use.
# To change your default snpahotter back to overlayfs, simply remove the snapshotters value from finch.yaml or set snapshotters to `overlayfs`
# To completely remove the snapshotters' binaries, shell into your VM and remove /usr/local/bin/{snapshotter binary}
# and remove the snapshotter configuration in the containerd config file found at /etc/containerd/config.toml
snapshotters :
- soci
# creds_helpers: a list of credential helpers that will be installed and configured automatically.
# Supported Credential Helpers List:
# - ecr-login https://github.com/awslabs/amazon-ecr-credential-helper
# Once the option has been set the credential helper will be installed on either finch vm init or finch vm start.
# The binary will be downloaded on the host machine and a config.json will be created and populated inside the ~/.finch/ folder
# if it doesn't already exist. If it already exists, the value of credsStore will be overwritten.
# To opt out of using the credential helper, remove the value from the credsStore parameter of config.json
# and remove the creds_helper value from finch.yaml.
# To completely remove the credential helper, either remove the binary from ~/.finch/creds-helpers or remove the creds-helpers
# folder entirely. (optional)
creds_helpers :
- ecr-login
# additional_directories: the work directories that are not supported by default. In macOS, only home directory is supported by default.
# For example, if you want to mount a directory into a container, and that directory is not under your home directory,
# then you'll need to specify this field to add that directory or any ascendant of it as a work directory. (optional)
additional_directories :
# the path of each additional directory.
- path : /Volumes
# vmType: sets which Hypervisor to use to launch the VM. (optional)
# Only takes effect when a new VM is launched (only on vm init).
# One of: "qemu", "vz".
# - "qemu": Uses QEMU as the Hypervisor.
# - "vz" (default): Uses Virtualization.framework as the Hypervisor.
#
# NOTE: prior to version 1.2.0, "qemu" was the default, and it will still be the default for
# macOS versions that do not support Virtualization.framework (pre-13.0.0).
vmType : " vz "
# rosetta: sets whether to enable Rosetta as the binfmt_misc handler for x86_64
# binaries inside the VM, as an alternative to qemu user mode emulation. (optional)
# Only takes effect when a new VM is launched (only on vm init).
# Only available when using vmType "vz" on Apple Silicon running macOS 13+.
# If true, also sets vmType to "vz".
#
# NOTE: while Rosetta is generally faster than qemu user mode emulation, it causes
# some performance regressions, as noted in this issue:
# https://github.com/lima-vm/lima/issues/1269
rosetta : false
# dockercompat: a configuration parameter to activate finch functionality to accept Docker-like commands and arguments.
# For running DevContainers on Finch, this functionality will convert Docker-like arguments into compatible nerdctl commands and arguments.
dockercompat : true
首次运行时将生成位于$env:LOCALAPPDATA.finchfinch.yaml
的配置文件。目前,由于 WSL 的限制,此配置文件没有系统资源限制选项。
有关配置选项的完整列表,请检查 Windows 的 finch 结构。
finch.yaml
示例如下所示:
# snapshotters: the snapshotters a user wants to use (the first snapshotter will be set as the default snapshotter)
# Supported Snapshotters List:
# - soci https://github.com/awslabs/soci-snapshotter/tree/main
# Once the option has been set the snapshotters will be installed on either finch vm init or finch vm start.
# The snapshotters binary will be downloaded on the virtual machine and will be configured and ready for use.
# To change your default snpahotter back to overlayfs, simply remove the snapshotters value from finch.yaml or set snapshotters to `overlayfs`
# To completely remove the snapshotters' binaries, shell into your VM and remove /usr/local/bin/{snapshotter binary}
# and remove the snapshotter configuration in the containerd config file found at /etc/containerd/config.toml
snapshotters :
- soci
# creds_helpers: a list of credential helpers that will be installed and configured automatically.
# Supported Credential Helpers List:
# - ecr-login https://github.com/awslabs/amazon-ecr-credential-helper
# Once the option has been set the credential helper will be installed on either finch vm init or finch vm start.
# The binary will be downloaded on the host machine and a config.json will be created and populated inside the ~/.finch/ folder
# if it doesn't already exist. If it already exists, the value of credsStore will be overwritten.
# To opt out of using the credential helper, remove the value from the credsStore parameter of config.json
# and remove the creds_helper value from finch.yaml.
# To completely remove the credential helper, either remove the binary from $env:LOCALAPPDATA.finchcreds-helpers or remove the creds-helpers
# folder entirely. (optional)
creds_helpers :
- ecr-login
# sets wsl2 Hypervisor to use to launch the VM. (optional)
vmType : " wsl2 "
# dockercompat: a configuration parameter to activate finch functionality to accept Docker-like commands and arguments.
# For running DevContainers on Finch, this functionality will convert Docker-like arguments into compatible nerdctl commands and arguments.
dockercompat : true
本节包含有关使用 Finch 的常见问题。
LIMA_HOME=/Applications/Finch/lima/data /Applications/Finch/lima/bin/limactl shell finch
wsl -d lima-finch
我们很高兴能够公开启动这个项目,我们很高兴收到您的来信。如果您有想法或发现错误,请提出问题。如果您有什么想要提议或集思广益的内容,请随时开始讨论。也欢迎请求请求!有关贡献的更多信息,以及感兴趣的人获得审阅者和维护者角色的路径,请参阅贡献文档。
随着项目取得一些进展,维护人员将开始创建里程碑并寻求建立定期的发布节奏。随着时间的推移,我们还将开始根据社区的想法和出现的问题制定公共路线图。我们已经有了一些想法,包括:
如果您想与我们聊天,请在 CNCF slack 上的#finch
频道中找到我们。