🚀BfD (blog for Drafts)

This is a draft post and the post may be closed to the public.

Difyのアップデートに失敗

ここ、1週間ほどDifyで試行錯誤して遊んでいます。

0.6.7から0.6.8にバージョンアップすると、OpenAIのGTP-4oが利用できるようになりました。

早速、Dockerで起動しているDifyをdocker-compose downして、アップデート

リポジトリを更新

git checkout main
git pull origin main

Dify起動

cd docker
docker compose up -d

これで更新されたDifyが起動するはずなのですが、docker-compose起動時に下記のエラーが発生

Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting "/home/user/docker/compose/dify/docker/volumes/ssrf_proxy/squid.conf" to rootfs at "/etc/squid/squid.conf" caused: mount through procfd: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

squid.confのマウントが失敗している模様

調査

dify/docker/volumes/ssrf_proxy 内を見てみると、squid.confと言うディレクトリとしてマウントされてました。

原因

difi/docker/volumesディレクトリの所有者がrootとなっており、一般ユーザーでgit pullした際に、パーミッションエラーでリポジトリが取得できてなかったのが原因でした。

解決

sudo で git pullするか、Githubからsquid.confを持ってくるなどして、squid.confのファイルを置くことで、無事起動した。

0.6.8 → 0.6.9

  • docker停止し、リポジトリ取得
$ docker-compose down
$ git checkout main
$ git pull origin main
…
Please move or remove them before you merge.
Aborting

いろいろ変更点や修正したファイルがあるので取得できない。

  • スタッシュを利用する
$ git add docker/docker-compose.yaml
$ git commit -m "my customize"
$ git pull origin main

$ git stash
$ git pull --rebase
$ git stash pop

  • 強制的に取得する場合
    (カスタマイズや修正したファイルがあればバックアップを取っておきましょう)
$ git fetch origin
$ git reset --hard origin/main
error: unable to create file docker/volumes/sandbox/dependencies/python-requirements.txt: 許可がありません
error: unable to unlink old 'docker/volumes/ssrf_proxy/squid.conf': 許可がありません
fatal: Could not reset index file to revision 'origin/main'.

Linux上のdockerで起動していた場合、volumesがroot権限になっていたので、一般ユーザーで実行するとパーミッションエラーが出ます。

$ sudo git reset --hard origin/main
HEAD is now at e60350d95 version to 0.6.9 (#4692)

sudoで取得した場合は、ファイルやディレクトリがroot権限になるので、望まない方は、chownで適宜変更しましょう。(ただし、Difyが正常に起動しなくなる可能性もあるのでご注意を!)

$ cd docker
$ docker-compose up -d

無事、0.6.9へ更新できました。