1.はじめに
macの仮想ドライブを作成した際に、特定のディレクトリで、Dockerfileをdocker build
できない現象があったので、覚え書き。
2.結論
macの仮想ドライブのルートディレクトリでは、docker build
ができない。
一つ下にディレクトリを用意して、その中で実行可能。
環境
M1 Macです。
$ uname -a Darwin mmac.local 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:20 PDT 2021; root:xnu-7195.141.6~3/RELEASE_ARM64_T8101 arm64
現象
- 仮想ドライブ
TEST_DISK
を作って、/Volumes/TEST_DISK
にマウント。そのディレクトリにDockerfileを作成。 - そのあと、
docker build
を実行
$ pwd /Volumes/TEST_DISK miyake@mmac(13:52:58) /Volumes/TEST_DISK $ docker build -t ubuntumine ./ [+] Building 0.0s (1/2) => ERROR [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 57B 0.0s ------ > [internal] load build definition from Dockerfile: ------ failed to solve with frontend dockerfile.v0: failed to read dockerfile: error from sender: open .DocumentRevisions-V100: operation not permitted
処置
$ pwd /Volumes/TEST_DISK $ mkdir docker $ cd docker $ cp ../Dockerfile ./ $ ls Dockerfile $ docker build -t ubuntumine ./ [+] Building 3.6s (7/7) FINISHED => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 176B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load metadata for docker.io/library/ubuntu:20 3.5s => [1/3] FROM docker.io/library/ubuntu:20.04@sha256:a0d9e82 0.0s => CACHED [2/3] RUN set -x && apt-get update 0.0s => CACHED [3/3] WORKDIR /var/workdir 0.0s => exporting to image 0.0s => => exporting layers 0.0s => => writing image sha256:5ced0c7ae3e3b3818bb66f78a8f16d96 0.0s => => naming to docker.io/library/ubuntumine 0.0s Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE ubuntumine latest 5ced0c7ae3e3 3 hours ago 92.2MB ubuntu 20.04 daab1c66d467 12 days ago 65.6MB
その他
「Operation not permitted」のエラーだったので、下記の手順も試したけど、今回の場合は有効ではありませんでした。
macOS Mojave/Catalina の「Operation not permitted」を回避する(du/ls/mv/cp 実行時) - Qiita