Open19

Miskkeyをローカルで動かす

You-sakuYou-saku

環境

OS => macOS Monterey
docker compose version => Docker Compose version v2.19.1
docker --version => Docker version 24.0.2
You-sakuYou-saku

いきなり詰まった

詰まったコマンド
sudo docker compose build
エラー文
+] Building 0.7s (3/3) FINISHED
 => [web internal] load .dockerignore                                                                    0.0s
 => => transferring context: 400B                                                                        0.0s
 => [web internal] load build definition from Dockerfile                                                 0.0s
 => => transferring dockerfile: 3.08kB                                                                   0.0s
 => ERROR [web] resolve image config for docker.io/docker/dockerfile:1.4                                 0.6s
------
 > [web] resolve image config for docker.io/docker/dockerfile:1.4:
------
WARN[0000] buildx: failed to read current commit information with git rev-parse --is-inside-work-tree
failed to solve: error getting credentials - err: exit status 1, out: ``
You-sakuYou-saku

サブモジュールが取れなかったのかな?
ちょっとcloneをやり直す

git clone --recursive https://github.com/misskey-dev/misskey.git
You-sakuYou-saku

先ほど同様にファイルコピーまで進める

cd misskey
git checkout master
cp .config/docker_example.yml .config/default.yml
cp .config/docker_example.env .config/docker.env
cp ./docker-compose.yml.example ./docker-compose.yml
You-sakuYou-saku

エラー変わらず

エラー文
+] Building 0.7s (3/3) FINISHED
 => [web internal] load .dockerignore                                                                    0.0s
 => => transferring context: 400B                                                                        0.0s
 => [web internal] load build definition from Dockerfile                                                 0.0s
 => => transferring dockerfile: 3.08kB                                                                   0.0s
 => ERROR [web] resolve image config for docker.io/docker/dockerfile:1.4                                 0.6s
------
 > [web] resolve image config for docker.io/docker/dockerfile:1.4:
------
WARN[0000] buildx: failed to read current commit information with git rev-parse --is-inside-work-tree
failed to solve: error getting credentials - err: exit status 1, out: ``
You-sakuYou-saku

これを解決する必要があるかも

WARN[0000] buildx: failed to read current commit information with git rev-parse --is-inside-work-tree
failed to solve: error getting credentials - err: exit status 1, out: ``
You-sakuYou-saku
docker buildx create --use

上記コマンドでbuildxを使える?ようにしたらエラー変わった

エラー文
[+] Building 0.0s (0/1)
[+] Building 0.1s (1/1) FINISHED
 => ERROR [web internal] booting buildkit                                                                0.1s
 => => pulling image moby/buildkit:buildx-stable-1                                                       0.1s
------
 > [web internal] booting buildkit:
------
error getting credentials - err: exit status 1, out: ``

[参考]
https://zenn.dev/bells17/articles/docker-buildx

You-sakuYou-saku

そして

sudo docker compose build

を実行したらビルドが進んだ?なぜだ...

You-sakuYou-saku

ん?

WARN[0012] buildx: failed to read current commit information with git rev-parse --is-inside-work-tree
You-sakuYou-saku

ひとまず無視して進めてくぞ

sudo docker compose run --rm web pnpm run init
You-sakuYou-saku

ターミナルがすごいことになるけどマイグレーションっぽいので大丈夫そう

You-sakuYou-saku

webコンテナが生きたり死んだりしたので

sudo docker compose down
sudo docker compose up -d

を何回かしてみたら...

You-sakuYou-saku

動いた!!!!!!!!!!!!!
トラブルシューティング部分が腹落ちしてないので宿題ですね

You-sakuYou-saku

docker周りで詰まったのはDocker Desktopのアップデートを久々にしたからかもしれない