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
頻道中找到我們。