[[Docker Desktop]]に代わる[[Rancher Desktop]]を使ってみた備忘録。 ## 前提 - [[Windows 10]] - [[Docker]]はアンインストール済 - `wsl`コマンドはインストール済 ## インストール > [!danger] [[Scoop]]を使った場合 > [[Scoopを使うとRancher Desktopをインストールできない]] https://docs.rancherdesktop.io/getting-started/installation#windows 1. [リリースページ](https://github.com/rancher-sandbox/rancher-desktop/releases)から `Rancher.Desktop.Setup.1.6.1.exe`をダウンロード 2. **管理者権限で**インストーラーを実行 3. PC再起動 > [!attention] > [[Windows]]の成果物は初期状態だと表示されず、展開が必要な場合があるので注意 ### 確認 [[Docker]]コマンドはインストールされてそう。 ```console $ which docker C:/Users/syoum/AppData/Local/Programs/Rancher Desktop/resources/resources/win32/bin/docker.exe ``` ## [[Rancher Desktop]]を起動 アプリケーションとして起動する。[[Docker Desktop]]の代替として使いたいだけなので、[[Kubernetes]]のチェックは外し、[[containerd]]ではなく[[dockerd]]を選ぶ。 ![[Pasted image 20221026210020.png]] > [!error] > [[📝2022-10-26 Windows10でRancher Desktopを起動するとKubernetes Errorになる]] ## Hello World Example https://docs.rancherdesktop.io/how-to-guides/hello-world-example [[Dockerfile]]を作成し、以下のようにする。 ```docker FROM alpine CMD ["echo", "Hello World!!"] ``` ### イメージのビルド ```console $ docker build --tag helloworld:v1.0 . Sending build context to Docker daemon 2.048kB Step 1/2 : FROM alpine latest: Pulling from library/alpine 213ec9aee27d: Pull complete Digest: sha256:bc41182d7ef5ffc53a40b044e725193bc10142a1243f395ee852a8d9730fc2ad Status: Downloaded newer image for alpine:latest ---> 9c6f07244728 Step 2/2 : CMD ["echo", "Hello World!!"] ---> Running in 687b0e4adf16 Removing intermediate container 687b0e4adf16 ---> 576d47215e08 Successfully built 576d47215e08 Successfully tagged helloworld:v1.0 SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories. ``` > [!error] [[Rancher Desktop]]は起動するのにdeamonとやりとりができず、`docker build`コマンドが失敗する > ターミナルの再起動でなおった。 ### イメージの確認 ```console $ docker images | grep helloworld helloworld v1.0 576d47215e08 5 minutes ago 5.54MB ``` ### イメージの実行 ```console Hello World!! ``` ### イメージの削除 ```console docker rmi helloworld:v1.0 ``` ## [[LocalStack]]を動かしてみる [[LocalStackでS3]]の設定を使って`compose.yml`を作成する。 `compose.yml` ```yaml version: '3' services: s3: image: localstack/localstack:latest hostname: s3 ports: - "4566:4566" networks: default: aliases: - s3.localhost.localstack.cloud - s3-website.localhost.localstack.cloud - minerva.s3.localhost.localstack.cloud - minerva.s3-website.localhost.localstack.cloud environment: SERVICES: s3 DEFAULT_REGION: ap-northeast-1 DEBUG: "1" expose: - "4566" ``` 実行する。 ```console docker compose up ``` 起動しているのを確認済。 ```console $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES aa8c663c9b76 localstack/localstack:latest "docker-entrypoint.sh" About a minute ago Up About a minute (healthy) 4510-4559/tcp, 5678/tcp, 0.0.0.0:4566->4566/tcp, :::4566->4566/tcp localstack-sample-s3-1 ``` 中に入って[[S3]]バケットを作成してみる。 ```console $ docker exec -it aa8c bash root@s3:/opt/code/localstack# aws --endpoint-url http://localhost:4566 configure AWS Access Key ID [None]: dummy AWS Secret Access Key [None]: dummy Default region name [None]: ap-northeast-1 Default output format [None]: root@s3:/opt/code/localstack# aws --endpoint-url http://localhost:4566 s3 mb s3://testbucket make_bucket: testbucket root@s3:/opt/code/localstack# aws --endpoint-url http://localhost:4566 s3 ls 2022-10-26 12:52:42 testbucket root@s3:/opt/code/localstack# aws --endpoint-url http://localhost:4566 s3 ls s3://testbucket/ root@s3:/opt/code/localstack# ``` ちゃんと動いてそう。中は[[Docker]]だからそこは安定か。[[Docker]]コマンド周りはおそらく問題なさそう。ネットワークも平気かな...? ## [[WSL]]のディストリビューション一覧 `rancher-desktop`と`rancher-desktop-data`が作成されている。 ```console $ wsl -l Linux 用 Windows サブシステム ディストリビューション: rancher-desktop (既定) rancher-desktop-data ``` 既存のディストリビューションがインストール済でも競合しなそうな雰囲気。 ## [[Rancher Desktop]]の見え方 イメージ一覧は最低限の情報が表示される。コンテナの情報はパッと見では確認できなそうだったが、基本的に[[CLI]]経由だから問題ない。[[GUI]]としての[[Docker Desktop]]を使ったことはないので実害もなさそう。 ![[Pasted image 20221026215558.png]] ただ、[[Docker Hub]]の[[Rate Limit]]は健在のため、[[Rate Limit]]がボトルネックになるようなもので使用するのはやめた方がよさそう。特に業務とか。