1
0

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 1 year has passed since last update.

Fixing docker 23 build failure due to ERROR: mkdir /root/.docker/buildx: read-only file system

Last updated at Posted at 2023-04-26

In some cases such as passing .docker/config.json to a container, you would mount /root/.docker as read-only. But this makes buildx wrong due to mkdir /root/.docker/buildx: read-only file system. The thing is, buildx is the default of docker 23.

I found that specifying BUILDX_CONFIG (eg BUILDX_CONFIG=/tmp/buildx) can resolve this issue. /tmp/buildx will be gone after exiting the container, but saving persistent config of buildx inside container is not useful anyway.


For my reference later, this is how I found the solution:

  1. ~/.docker/buildx/activity の存在を思い出す
  2. https://docs.docker.com/build/release-notes/#0100 から https://github.com/docker/buildx/pull/1439 を発見する
  3. https://github.com/docker/buildx/blob/v0.10.4/store/store.go のNewで失敗していることを把握する
  4. https://github.com/docker/buildx/blob/v0.10.4/store/storeutil/storeutil.go
  5. https://github.com/docker/buildx/blob/v0.10.4/util/confutil/config.go とたどり、当該Newの引数はBUILDX_CONFIGでオーバーライドできることを把握する

(我ながら目茶苦茶なたどり方だなぁ)

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?