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

久しぶりに`docker build .`したらエラーが出た。。(the --mount option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled)

Posted at

久しぶりにdocker build .したらエラーが出た。。

$ docker build .
Sending build context to Docker daemon  234.5kB
Step 1/6 : FROM python:3.10-slim-bullseye
 ---> 634cac419191
...
Step 3/6 : RUN --mount=type=cache,target=/var/cache/apt,sharing=locked     apt update &&     apt upgrade -y &&     apt install -y         wget         curl         git         build-essential &&     mkdir /tetris
the --mount option requires BuildKit.
Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled

リンク(https://docs.docker.com/go/buildkit/ )記載の通り、DOCKER_BUILDKIT=1 つけても同様、、

DOCKER_BUILDKIT=1 docker-compose -f docker-compose.pytorch.yaml build
Building 
...
Step 3/6 : RUN --mount=type=cache,target=/var/cache/apt,sharing=locked     apt update &&     apt upgrade -y &&     apt install -y         wget         curl         git         build-essential &&     mkdir /tetris
ERROR: Service 'tetris' failed to build: 
the --mount option requires BuildKit. 
Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled

エラー出たときの環境

$ docker-compose -v
docker-compose version 1.25.0, build unknown
$ docker -v
Docker version 20.10.12, build 20.10.12-0ubuntu2~20.04.1

結局、docker engineを最新に更新して、docker compose(docker-composeではなく)を使ったらビルド成功した

$ docker --version
Docker version 24.0.4, build 3713ee1
$ docker compose version
Docker Compose version v2.19.1
$ docker compose -f docker-compose.pytorch.yaml build
[+] Building 0.2s (11/11) FINISHED 

以下メモ

どうやら、Docker Engine version 23.0.0からdocker-buildx-pluginが分離されているようだった

https://docs.docker.com/engine/release-notes/23.0/
From Docker Engine version 23.0.0, Buildx is distributed in a separate package: docker-buildx-plugin. In earlier versions, Buildx was included in the docker-ce-cli package. When you upgrade to this version of Docker Engine, make sure you update all packages. For example, on Ubuntu:

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

sudo apt update -y
sudo apt upgrade -y

Docker再インストール

以下の通り最新にすることができました

$ docker --version
Docker version 24.0.4, build 3713ee1
$ docker compose version
Docker Compose version v2.19.1

参考

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