Site cover image

Site icon imageおかしんワークス

ビジネステクノロジーエンジニア @okash1n のブログです

Docker Desktop 代替の「Finch」を使ってみた

スタディスト Tech Blog Advent Calendar 2022の8日目を担当します。管理部 ビジネステクノロジーユニットの okash1n です。

以前Docker Desktop の有料化についてのお話を書きましたが、Macにおける代替手段の紹介があまり出来ていなかった為、先日 11/23 にAWSが突如公開した「Finch」というOSSツールを紹介します。

Finchとは

Finch is a new command line client for building, running, and publishing Linux containers. It provides for simple installation of a native macOS client, along with a curated set of de facto standard open source components including Lima, nerdctl, containerd, and BuildKit. With Finch, you can create and run containers locally, and build and publish Open Container Initiative (OCI) container images.

簡単に言うと、MacOSクライアント上でDockerを動かすためにLimaやnerdctlなどの各種OSSをひとまとめにして簡単に構築出来るようにしたもの、ということです。

類似のサービスでは Rancher Desktop が存在しています。

Rancher Desktopとの差異としては、FinchにはGUIがなかったり、Windowsには現状対応していないといった違いがあります。

使ってみる

リポジトリのREADMEを参考に進めます

インストール

Intel CPUのMacBook Proで実施します

brew install --cask finch

==> Downloading https://github.com/runfinch/finch/releases/download/v0.1.0/Finch
==> Downloading from https://objects.githubusercontent.com/github-production-rel
######################################################################## 100.0%
==> Installing Cask finch
==> Running installer for finch; your password may be necessary.
Package installers may write to any location; options such as `--appdir` are ignored.
Password:
installer: Package name is Finch
installer: Installing at base path /
installer: The install was successful.
🍺  finch was successfully installed!

初回起動

初回のみ、 finch vm init で仮想マシンの起動を行う必要があるようです。

$ finch vm init

INFO[0000] Using default values due to missing config file at "/Users/okash1n/.finch/finch.yaml"
INFO[0000] "/Users/okash1n/.finch" directory doesn't exist, attempting to create it
INFO[0000] binaries directory doesn't exist
INFO[0000] Requesting root access to finish network dependency configuration
INFO[0000] sudoers file not found: %!w(*fs.PathError=&{open /etc/sudoers.d/finch-lima 2})
INFO[0000] Initializing and starting Finch virtual machine...
INFO[0152] Finch virtual machine started successfully

これによってMac上でLima仮想マシンが構築されます

Dockerイメージの起動

$ finch run --rm public.ecr.aws/finch/hello-finch

public.ecr.aws/finch/hello-finch:latest:                                          resolved       |++++++++++++++++++++++++++++++++++++++|
index-sha256:a71e474da9ffd6ec3f8236dbf4ef807dd54531d6f05047edaeefa758f1b1bb7e:    done           |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:2f848edb93f7d0cfa20d7dc7add84586fe06d258d6dd54422d8015c584ff3b9e: done           |++++++++++++++++++++++++++++++++++++++|
config-sha256:50c36f221209ea6829db90eff11db167d8cc22abf7c2c0f1e7f4a0c701c0592f:   done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:cb7e3bc996dd3208c5b4560d5f6571486e2fe90b5a1cc384e2d6af0dc07de02a:    done           |++++++++++++++++++++++++++++++++++++++|
elapsed: 3.3 s                                                                    total:  1.0 Mi (322.2 KiB/s)

                            @@@@@@@@@@@@@@@@@@@
                        @@@@@@@@@@@@    @@@@@@@@@@@
                      @@@@@@@                  @@@@@@@
                    @@@@@@                        @@@@@@
                  @@@@@@                            @@@@@
                 @@@@@                      @@@#     @@@@@@@@@
                @@@@@                     @@   @@@       @@@@@@@@@@
                @@@@%                     @     @@            @@@@@@@@@@@
                @@@@                                               @@@@@@@@
                @@@@                                         @@@@@@@@@@@&
                @@@@@                                  &@@@@@@@@@@@
                 @@@@@                               @@@@@@@@
                  @@@@@                            @@@@@(
                   @@@@@@                        @@@@@@
                     @@@@@@@                  @@@@@@@
                        @@@@@@@@@@@@@@@@@@@@@@@@@@
                            @@@@@@@@@@@@@@@@@@


Hello from Finch!

Visit us @ github.com/runfinch

dockerでは docker run にあたるものが finch run になります。その他の docker のオプションも基本的には対応しているようなので、 docker を finch に置き換えれば、ほとんどの動作が行えるものと思われます(未確認)

$ git clone git@github.com:runfinch/finch.git
cd finch/contrib/hello-finch
finch build . -t hello-finch

$ finch images
REPOSITORY                          TAG       IMAGE ID        CREATED               PLATFORM       SIZE       BLOB SIZE
hello-finch                         latest    5e3186b8222b    About a minute ago    linux/amd64    1.7 MiB    1.0 MiB
public.ecr.aws/finch/hello-finch    latest    a71e474da9ff    5 minutes ago         linux/amd64    1.7 MiB    1.0 MiB

$ finch run hello-finch


                            @@@@@@@@@@@@@@@@@@@
                        @@@@@@@@@@@@    @@@@@@@@@@@
                      @@@@@@@                  @@@@@@@
                    @@@@@@                        @@@@@@
                  @@@@@@                            @@@@@
                 @@@@@                      @@@#     @@@@@@@@@
                @@@@@                     @@   @@@       @@@@@@@@@@
                @@@@%                     @     @@            @@@@@@@@@@@
                @@@@                                               @@@@@@@@
                @@@@                                         @@@@@@@@@@@&
                @@@@@                                  &@@@@@@@@@@@
                 @@@@@                               @@@@@@@@
                  @@@@@                            @@@@@(
                   @@@@@@                        @@@@@@
                     @@@@@@@                  @@@@@@@
                        @@@@@@@@@@@@@@@@@@@@@@@@@@
                            @@@@@@@@@@@@@@@@@@


Hello from Finch!

Visit us @ github.com/runfinch

感想

finch コマンドがほぼ docker コマンドとして利用できますが、 docker コマンドや nerdctl が直接使えるわけではないので、個人的にはPythonの conda を使ってる時のような気持ち悪さがありました。

競合の Rancher Desktopは、Docker Desktop とほとんど同じように docker コマンドや minikube などが使えるので、現状ではDocker Desktop からの移行をするには Rancher Desktop の方が良いのかなと思います。

とはいえ finch はまだ Ver. 0.1 ですし、これからWindows対応、Kubernetes対応、GUI化等々色々進むかと思うので、今後に期待ですね。

以上、簡単ではありますがFinch利用レポートでした。