7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Lima + containerdにおけるEROFS: read-only file system

Last updated at Posted at 2021-09-12

TL;DR

  • dockerで設定できていたWORKDIRが、containerdでは書き込み権限がないかもしれないことに注意
      • WORKDIR /usr/local/app: Linuxディレクトリ構造のベーシックに倣って配置(って考えたんだと思う)
        • serverless-webpack利用時、rimrafによる一時ファイルの削除が発生
          • EROFS発生:innocent:
      • 単に、WORKDIR /app等書き込み権限があるディレクトリに配置すればOK
  • Lima起因なのか、containerd起因なのかは未調査。Rootless関連な気もする。
    • 知ってる人教えてほしいです:pray:

経緯

  1. Docker Desktop有料化に伴い、そのほかの選択肢を検討
  2. nttlabsのLima + nerdctlの記事を発見
  3. その時手元にあり、仕事でも使っている以下の構成のdocker-composeで実験してみることに
    • hasura (って何?: Hasura)
      • hasura/graphql-engine:v2.0.8.cli-migrations-v2
    • postgres (みなさんご存知: PostgreSQL)
      • postgres:12.6
    • hasura_actions (用途: Actions, Event Triggers, Scheduled Triggers)
      • serverless
        • template: aws-nodejs-typescript
      • serverless-webpack
      • serverless-offline
  4. lima nerdctl compose -f docker-compose.yaml upで起動を試す
  5. Error: EROFS: read-only file system, rmdir '/usr/local/hasura-actions/.webpack' 発生。serverlessコンテナの起動に失敗する

エラー全文

hasura_actions_1 | Error ---------------------------------------------------
hasura_actions_1 |
hasura_actions_1 |  Error: EROFS: read-only file system, rmdir '/usr/local/hasura-actions/.webpack'
hasura_actions_1 |      at Object.rmdirSync (fs.js:912:10)
hasura_actions_1 |      at rmdirSync (/usr/local/hasura-actions/node_modules/fs-extra/lib/remove/rimraf.js:264:13)
hasura_actions_1 |      at Object.rimrafSync (/usr/local/hasura-actions/node_modules/fs-extra/lib/remove/rimraf.js:243:7)
hasura_actions_1 |      at processConfig (/usr/local/hasura-actions/node_modules/serverless-webpack/lib/validate.js:205:13)
hasura_actions_1 |      at ServerlessWebpack.validate (/usr/local/hasura-actions/node_modules/serverless-webpack/lib/validate.js:275:14)
hasura_actions_1 |  From previous event:
hasura_actions_1 |      at Object.webpack:validate:validate [as hook] (/usr/local/hasura-actions/node_modules/serverless-webpack/index.js:156:63)
hasura_actions_1 |      at PluginManager.invoke (/usr/local/hasura-actions/node_modules/serverless/lib/classes/PluginManager.js:576:20)
hasura_actions_1 |      at PluginManager.spawn (/usr/local/hasura-actions/node_modules/serverless/lib/classes/PluginManager.js:598:16)
hasura_actions_1 |      at ServerlessWebpack.prepareOfflineInvoke (/usr/local/hasura-actions/node_modules/serverless-webpack/lib/prepareOfflineInvoke.js:15:42)
hasura_actions_1 |      at processImmediate (internal/timers.js:464:21)
hasura_actions_1 |  From previous event:
hasura_actions_1 |      at Object.before:offline:start [as hook] (/usr/local/hasura-actions/node_modules/serverless-webpack/index.js:177:12)
hasura_actions_1 |      at PluginManager.invoke (/usr/local/hasura-actions/node_modules/serverless/lib/classes/PluginManager.js:576:20)
hasura_actions_1 |      at PluginManager.run (/usr/local/hasura-actions/node_modules/serverless/lib/classes/PluginManager.js:634:18)
hasura_actions_1 |      at Serverless.run (/usr/local/hasura-actions/node_modules/serverless/lib/Serverless.js:431:5)
hasura_actions_1 |      at /usr/local/hasura-actions/node_modules/serverless/scripts/serverless.js:685:9
hasura_actions_1 |
hasura_actions_1 |     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
hasura_actions_1 |
hasura_actions_1 |  Get Support --------------------------------------------
hasura_actions_1 |     Docs:          docs.serverless.com
hasura_actions_1 |     Bugs:          github.com/serverless/serverless/issues
hasura_actions_1 |     Issues:        forum.serverless.com
hasura_actions_1 |
hasura_actions_1 |  Your Environment Information ---------------------------
hasura_actions_1 |     Operating System:          linux
hasura_actions_1 |     Node Version:              14.17.6
hasura_actions_1 |     Framework Version:         2.47.0 (local)
hasura_actions_1 |     Plugin Version:            5.4.0
hasura_actions_1 |     SDK Version:               4.2.3
hasura_actions_1 |     Components Version:        3.12.0
hasura_actions_1 |

調査

検索したクエリを並べますが、以下で答えがみつからず。

  • lima nerdctl compose EROFS
  • containerd EROFS
  • containerd webpack rimraf
  • webpack rimraf EROFS

まあエラー読めば明らかに対象ディレクトリに書き込み権限がないことはわかるのですが、思ったよりこのエラーに出くわす人・記事がいない。

ベーシックなDockerfileの書き方を漁っているうちに、「あれ、みんなWORKDIR /hogeあたりに設定してるな」と気づき、Dockerfileを書き換えたところ動きました。

3, 4時間調査に使って同じ症状の人に辿り着かなかったので結構マイナーな可能性はありますが、後続に苦しむ人がいる可能性を考えて書き残します。

おわりに

しばらくぶりの記事でした。
サラッと流しましたが、Hasura + serverlessの環境ってほとんど検索ヒットしないので、そこらへんの記事も書きたい。このスタックでサービスリリースしていたりもするので。

7
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?