検索しても見つからなかったのでメモ。
Cannot create container for service web: failed to copy files: failed to open target
→ .dockerignoreで定義したディレクトリをホストでディレクトリ毎消したのが原因かも。

“ENOSPC: no space left on device
→ 一般的には、ホストのディスク容量かinode不足が原因だが。。。

事象1

rubocopやerdでも、全てダメな感じ。

% docker-compose run web java -jar db/schemaspy-6.1.0.jar -configFile db/schemaspy.properties
Creating rails-app-origin_web_run ... error

ERROR: for rails-app-origin_web_run  Cannot create container for service web: failed to copy files: failed to open target /var/lib/docker/volumes/2d01425aab66c9fdda564882f01d7ae0ac98f47c6acea4e7e26e9442fc3d5733/_data/webpack-dev-middleware/CHANGELOG.md: open /var/lib/docker/volumes/2d01425aab66c9fdda564882f01d7ae0ac98f47c6acea4e7e26e9442fc3d5733/_data/webpack-dev-middleware/CHANGELOG.md: no space left on device

ERROR: for web  Cannot create container for service web: failed to copy files: failed to open target /var/lib/docker/volumes/2d01425aab66c9fdda564882f01d7ae0ac98f47c6acea4e7e26e9442fc3d5733/_data/webpack-dev-middleware/CHANGELOG.md: open /var/lib/docker/volumes/2d01425aab66c9fdda564882f01d7ae0ac98f47c6acea4e7e26e9442fc3d5733/_data/webpack-dev-middleware/CHANGELOG.md: no space left on device
ERROR: Encountered errors while bringing up the project.

コンソールに接続して、実行すると行ける。

% docker exec -i -t rails-app-origin_web_1 bash
bash-5.1# java -jar db/schemaspy-6.1.0.jar -configFile db/schemaspy.properties
  ____       _                          ____
 / ___|  ___| |__   ___ _ __ ___   __ _/ ___| _ __  _   _
 \___ \ / __| '_ \ / _ \ '_ ` _ \ / _` \___ \| '_ \| | | |
  ___) | (__| | | |  __/ | | | | | (_| |___) | |_) | |_| |
 |____/ \___|_| |_|\___|_| |_| |_|\__,_|____/| .__/ \__, |
                                             |_|    |___/

                                              6.1.0

試行錯誤

Docker DesktopをRestart → NG
コンテナとイメージ全消し → NG
コンテナ全消し+Docker DesktopをRestart → NG
コンテナとイメージ全消し+Docker DesktopをRestart → OK

コンテナ停止
% docker-compose down

コンテナ全消し
% docker container prune
Are you sure you want to continue? [y/N] y

イメージ全消し
% docker images -aq | xargs docker rmi

Docker DesktopをRestart

コンテナ作成&起動
% docker-compose up --build

事象2

% docker-compose build
db uses an image, skipping
java uses an image, skipping
Building web
[+] Building 11.4s (11/13)                                                                                                                                      
 => [internal] load build definition from Dockerfile                                                                                                       0.0s
 => => transferring dockerfile: 728B                                                                                                                       0.0s
 => [internal] load .dockerignore                                                                                                                          0.0s
 => => transferring context: 35B                                                                                                                           0.0s
 => [internal] load metadata for docker.io/library/ruby:3.0.0-alpine                                                                                       2.9s
 => [internal] load build context                                                                                                                          0.0s
 => => transferring context: 156B                                                                                                                          0.0s
 => [1/9] FROM docker.io/library/ruby:3.0.0-alpine@sha256:17fcf2715439387dc050fcd6801a98c6b61c196739e56d4c8a12d93bb0dcecac                                 0.0s
 => CACHED [2/9] RUN apk update && apk add --no-cache --update build-base tzdata bash yarn python2 imagemagick graphviz ttf-freefont mysql-dev mysql-clie  0.0s
 => CACHED [3/9] WORKDIR /workdir                                                                                                                          0.0s
 => CACHED [4/9] COPY Gemfile Gemfile.lock ./                                                                                                              0.0s
 => CACHED [5/9] RUN bundle install --no-cache                                                                                                             0.0s
 => CACHED [6/9] COPY package.json yarn.lock ./                                                                                                            0.0s
 => ERROR [7/9] RUN yarn install && yarn cache clean                                                                                                       8.3s
------                                                                                                                                                          
 > [7/9] RUN yarn install && yarn cache clean:                                                                                                                  
#11 0.314 yarn install v1.22.10                                                                                                                                 
#11 0.366 [1/4] Resolving packages...                                                                                                                           
#11 0.613 [2/4] Fetching packages...                                                                                                                            
#11 7.937 error Could not write file "/workdir/yarn-error.log": "ENOSPC: no space left on device, open '/workdir/yarn-error.log'"                               
#11 7.937 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
#11 7.937 error An unexpected error occurred: "ENOSPC: no space left on device, mkdir '/usr/local/share/.cache/yarn/v6/npm-css-color-names-0.0.4-808adc2e79cf84738069b646cb20ec27beb629e0-integrity/node_modules'".
------
executor failed running [/bin/sh -c yarn install && yarn cache clean]: exit code: 1
ERROR: Service 'web' failed to build : Build failed

試行錯誤

ホストのディスク容量かinode不足だと出るらしいが、両方とも問題なかった。
全消ししたら、動くようになった。
何度も調整してbuildしたから、増え過ぎたのかもね。

イメージ・ボリューム・コンテナ・ネットワーク全消し
% docker system prune
Are you sure you want to continue? [y/N] y

コンテナ作成&起動
% docker-compose up --build

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です