【Docker】build時のログを詳細に出力する

## build時のログを詳細に出力する
デフォルトでは`docker compose build`などを実行すると以下のように出力されます。
```:ターミナル
% docker compose build --no-cache 
[+] Building 18.3s (27/27) FINISHED                                                                        
 => [rails-gitlint-test2_web internal] load build definition from Dockerfile                          0.0s
 => => transferring dockerfile: 32B                                                                   0.0s
 => [rails-gitlint-test2_api internal] load build definition from Dockerfile                          0.0s
 => => transferring dockerfile: 828B                                                                  0.0s
 => [rails-gitlint-test2_db internal] load build definition from Dockerfile                           0.0s
 => => transferring dockerfile: 31B                                                                   0.0s
 => [rails-gitlint-test2_web internal] load .dockerignore                                             0.0s
 => => transferring context: 2B                                                                       0.0s
 => [rails-gitlint-test2_api internal] load .dockerignore                                             0.0s
 => => transferring context: 2B                                                                       0.0s
 => [rails-gitlint-test2_db internal] load .dockerignore                                              0.0s
 => => transferring context: 2B                                                                       0.0s
 => [rails-gitlint-test2_web internal] load metadata for docker.io/library/nginx:1.21.6               1.8s
 => [rails-gitlint-test2_api internal] load metadata for docker.io/library/ruby:3.1.2                 1.8s
 => [rails-gitlint-test2_db internal] load metadata for docker.io/library/mysql:8.0.29                1.8s
 => [auth] library/ruby:pull token for registry-1.docker.io                                           0.0s
 => [auth] library/mysql:pull token for registry-1.docker.io                                          0.0s
 => [auth] library/nginx:pull token for registry-1.docker.io                                          0.0s
 => CACHED [rails-gitlint-test2_web 1/4] FROM docker.io/library/nginx:1.21.6@sha256:2bcabc23b45489fb  0.0s
 => [rails-gitlint-test2_web internal] load build context                                             0.0s
 => => transferring context: 32B                                                                      0.0s
 => CACHED [rails-gitlint-test2_api 1/7] FROM docker.io/library/ruby:3.1.2@sha256:ffdb4e42cf4663e10c  0.0s
 => [rails-gitlint-test2_api internal] load build context                                             0.0s
 => => transferring context: 392B                                                                     0.0s
 => [rails-gitlint-test2_web 2/4] RUN rm -f /etc/nginx/conf.d/*                                       0.3s
 => CACHED [rails-gitlint-test2_db 1/1] FROM docker.io/library/mysql:8.0.29@sha256:152cf187a3efc56af  0.0s
 => [rails-gitlint-test2_api] exporting to image                                                      0.8s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
```


`build`実行時に`--progress=plain`を追記することでより詳細なログを出力させられます。

```:ターミナル
$ docker compose build --progress=plain
#1 [rails-gitlint-test2_api internal] load build definition from Dockerfile
#1 transferring dockerfile: 79B done
#1 DONE 0.0s

#2 [rails-gitlint-test2_web internal] load build definition from Dockerfile
#2 transferring dockerfile: 32B done
#2 DONE 0.0s

#3 [rails-gitlint-test2_db internal] load build definition from Dockerfile
#3 transferring dockerfile: 31B done
#3 DONE 0.0s

#4 [rails-gitlint-test2_api internal] load .dockerignore
#4 transferring context: 2B done
#4 DONE 0.0s

#5 [rails-gitlint-test2_web internal] load .dockerignore
#5 transferring context: 2B 0.0s done
#5 DONE 0.0s

#6 [rails-gitlint-test2_db internal] load .dockerignore
#6 transferring context: 2B done
#6 DONE 0.0s

#7 [rails-gitlint-test2_api internal] load metadata for docker.io/library/ruby:3.1.2
#7 ...

#8 [rails-gitlint-test2_web internal] load metadata for docker.io/library/nginx:1.21.6
#8 DONE 0.8s

#7 [rails-gitlint-test2_api internal] load metadata for docker.io/library/ruby:3.1.2
#7 DONE 0.8s

#9 [rails-gitlint-test2_api 1/7] FROM docker.io/library/ruby:3.1.2@sha256:fffeafa2d3ea91312b61df931b41439c16f7b88a7f6e70a65b6d
#9 CACHED

#10 [rails-gitlint-test2_api internal] load build context
#10 transferring context: 392B done
#10 DONE 0.0s

#11 [rails-gitlint-test2_web 1/4] FROM docker.io/library/nginx:1.21.6@sha256:faefwafeawfewafgtrhrs69a06ba1d648aeda973fae7bb981bafbb884165e514
#11 CACHED

#12 [rails-gitlint-test2_db internal] load metadata for docker.io/library/mysql:8.0.29
#12 DONE 0.9s

#13 [rails-gitlint-test2_db 1/1] FROM docker.io/library/mysql:8.0.29@sha256:fafeageghrshesges77b4d21e231d1d6eb828ca9221056590b0ac834c75
#13 CACHED

#14 [rails-gitlint-test2_web internal] load build context
#14 transferring context: 32B done
#14 DONE 0.0s

#15 [rails-gitlint-test2_db] exporting to image
#15 exporting layers done
#15 writing image sha256:fafewafewfewage36901ae749646ffa73d11068a2e0fb115f6cf1b23fa3
#15 writing image sha256:htrehrthteaaga036901ae749646ffa73d11068a2e0fb115f6cf1b23fa3 done
#15 naming to docker.io/library/rails-gitlint-test2_db done
#15 DONE 0.0s

#16 [rails-gitlint-test2_web 2/4] RUN rm -f /etc/nginx/conf.d/*
#16 DONE 0.2s

#17 [rails-gitlint-test2_web 3/4] COPY nginx.conf /etc/nginx/conf.d/myapp.conf
#17 DONE 0.0s

#18 [rails-gitlint-test2_api 2/7] RUN adduser ruby
#18 0.238 Adding user `ruby' ...
#18 0.238 Adding new group `ruby' (1000) ...
#18 0.249 Adding new user `ruby' (1000) with group `ruby' ...
#18 0.269 Creating home directory `/home/ruby' ...
#18 0.269 Copying files from `/etc/skel' ...

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
```
また環境変数を使用することでも同様のことが可能です。
```:ターミナル
$ export BUILDKIT_PROGRESS=plain
$ docker compose build --progress=plain
#1 [rails-gitlint-test2_api internal] load build definition from Dockerfile
#1 transferring dockerfile: 79B done
#1 DONE 0.0s

#2 [rails-gitlint-test2_web internal] load build definition from Dockerfile
#2 transferring dockerfile: 32B done
#2 DONE 0.0s

#3 [rails-gitlint-test2_db internal] load build definition from Dockerfile
#3 transferring dockerfile: 31B done
#3 DONE 0.0s

#4 [rails-gitlint-test2_api internal] load .dockerignore
#4 transferring context: 2B done
#4 DONE 0.0s

#5 [rails-gitlint-test2_web internal] load .dockerignore
#5 transferring context: 2B 0.0s done
#5 DONE 0.0s

#6 [rails-gitlint-test2_db internal] load .dockerignore
#6 transferring context: 2B done
#6 DONE 0.0s

#7 [rails-gitlint-test2_api internal] load metadata for docker.io/library/ruby:3.1.2
#7 ...

#8 [rails-gitlint-test2_web internal] load metadata for docker.io/library/nginx:1.21.6
#8 DONE 0.8s

#7 [rails-gitlint-test2_api internal] load metadata for docker.io/library/ruby:3.1.2
#7 DONE 0.8s

#9 [rails-gitlint-test2_api 1/7] FROM docker.io/library/ruby:3.1.2@sha256:fffeafa2d3ea91312b61df931b41439c16f7b88a7f6e70a65b6d
#9 CACHED

#10 [rails-gitlint-test2_api internal] load build context
#10 transferring context: 392B done
#10 DONE 0.0s

#11 [rails-gitlint-test2_web 1/4] FROM docker.io/library/nginx:1.21.6@sha256:faefwafeawfewafgtrhrs69a06ba1d648aeda973fae7bb981bafbb884165e514
#11 CACHED

#12 [rails-gitlint-test2_db internal] load metadata for docker.io/library/mysql:8.0.29
#12 DONE 0.9s

#13 [rails-gitlint-test2_db 1/1] FROM docker.io/library/mysql:8.0.29@sha256:fafeageghrshesges77b4d21e231d1d6eb828ca9221056590b0ac834c75
#13 CACHED

#14 [rails-gitlint-test2_web internal] load build context
#14 transferring context: 32B done
#14 DONE 0.0s

#15 [rails-gitlint-test2_db] exporting to image
#15 exporting layers done
#15 writing image sha256:fafewafewfewage36901ae749646ffa73d11068a2e0fb115f6cf1b23fa3
#15 writing image sha256:htrehrthteaaga036901ae749646ffa73d11068a2e0fb115f6cf1b23fa3 done
#15 naming to docker.io/library/rails-gitlint-test2_db done
#15 DONE 0.0s

#16 [rails-gitlint-test2_web 2/4] RUN rm -f /etc/nginx/conf.d/*
#16 DONE 0.2s

#17 [rails-gitlint-test2_web 3/4] COPY nginx.conf /etc/nginx/conf.d/myapp.conf
#17 DONE 0.0s

#18 [rails-gitlint-test2_api 2/7] RUN adduser ruby
#18 0.238 Adding user `ruby' ...
#18 0.238 Adding new group `ruby' (1000) ...
#18 0.249 Adding new user `ruby' (1000) with group `ruby' ...
#18 0.269 Creating home directory `/home/ruby' ...
#18 0.269 Copying files from `/etc/skel' ...

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
```