docker build

built-in
0.0% Savings
0 Commands
0 Tokens saved
2 Tests

Install

tokf install a0551fffa4dff0610835ca575fe99d432567647e82cef450321887010e4359eb
Safety checks passed

Filter definition

command = ["docker build", "docker buildx build"]
description = "Strip layer transfer noise; show build steps and errors"
skip = [
  "^ +=> +=> [a-z]",      # Skip transferring, fetching, extracting
  "^ +=> +\\[internal\\]", # Skip metadata loading (noise)
  "^Sending build context",
]

[on_success]
skip = [
  "^ +=> +\\[[0-9/]+\\]", # Skip routine steps like [1/5]
  "^Step [0-9/]+ : ",      # Skip legacy step headers
  "^ ---> [0-9a-f]+",      # Skip legacy hash markers
  "^ ---> Using cache",   # Skip legacy cache messages
]

[on_failure]
tail = 50

Examples

failed build shows ERROR and package name ~426 tokens → ~326 tokens (23% saved)
Raw output
[+] Building 4.5s (8/12)
 => [internal] load build definition from Dockerfile                       0.0s
 => => transferring dockerfile: 37B                                        0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
 => [internal] load metadata for docker.io/library/ubuntu:22.04            0.4s
 => [1/5] FROM docker.io/library/ubuntu:22.04@sha256:ed15...              0.0s
 => CACHED [2/5] RUN apt-get update                                        0.0s
 => [3/5] RUN apt-get install -y --no-install-recommends curl git         4.1s
 => => # Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
 => => # Get:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
 => => # Get:3 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [109 kB]
 => => # Get:4 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
 => => # Fetching...
 => => # Extracting...
 => [4/5] RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -      0.2s
 => ERROR [5/5] RUN apt-get install -y nodejss                             0.1s
------
 > [5/5] RUN apt-get install -y nodejss:
#0 0.123 Reading package lists...
#0 0.456 Building dependency tree...
#0 0.789 Reading state information...
#0 0.901 E: Unable to locate package nodejss
------
Dockerfile:12
--------------------
  10 |     RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -
  11 |     
  12 | >>> RUN apt-get install -y nodejss
  13 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get install -y nodejss" did not complete successfully: exit code: 100
Filtered output
[+] Building 4.5s (8/12)
 => [1/5] FROM docker.io/library/ubuntu:22.04@sha256:ed15...              0.0s
 => CACHED [2/5] RUN apt-get update                                        0.0s
 => [3/5] RUN apt-get install -y --no-install-recommends curl git         4.1s
 => => # Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
 => => # Get:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
 => => # Get:3 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [109 kB]
 => => # Get:4 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
 => => # Fetching...
 => => # Extracting...
 => [4/5] RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -      0.2s
 => ERROR [5/5] RUN apt-get install -y nodejss                             0.1s
------
 > [5/5] RUN apt-get install -y nodejss:
#0 0.123 Reading package lists...
#0 0.456 Building dependency tree...
#0 0.789 Reading state information...
#0 0.901 E: Unable to locate package nodejss
------
Dockerfile:12
--------------------
  10 |     RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -
  11 |     
  12 | >>> RUN apt-get install -y nodejss
  13 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get install -y nodejss" did not complete successfully: exit code: 100
successful build shows CACHED and FINISHED, hides noise ~442 tokens → ~211 tokens (52% saved)
Raw output
[+] Building 1.2s (12/12) FINISHED
 => [internal] load build definition from Dockerfile                       0.0s
 => => transferring dockerfile: 37B                                        0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
 => [internal] load metadata for docker.io/library/node:18-alpine          0.5s
 => [base 1/2] FROM docker.io/library/node:18-alpine@sha256:c7c2...        0.0s
 => CACHED [base 2/2] WORKDIR /app                                         0.0s
 => CACHED [deps 1/2] COPY package.json package-lock.json ./               0.0s
 => CACHED [deps 2/2] RUN npm ci                                           0.0s
 => CACHED [build 1/2] COPY . .                                            0.0s
 => CACHED [build 2/2] RUN npm run build                                   0.0s
 => [final 1/2] COPY --from=build /app/dist /usr/share/nginx/html          0.1s
 => [final 2/2] EXPOSE 80                                                  0.0s
 => exporting to image                                                     0.1s
 => => exporting layers                                                    0.1s
 => => writing image sha256:d5f...                                         0.0s
 => => naming to docker.io/library/myapp:latest                            0.0s

# Legacy (non-BuildKit) output
Sending build context to Docker daemon  2.048kB
Step 1/10 : FROM node:18-alpine
 ---> c7c2...
Step 2/10 : WORKDIR /app
 ---> Using cache
 ---> d5f...
Step 3/10 : COPY package.json package-lock.json ./
 ---> Using cache
 ---> a1b...
Step 4/10 : RUN npm ci
 ---> Using cache
 ---> f2e...
Successfully built f2e...
Successfully tagged myapp:latest
Filtered output
[+] Building 1.2s (12/12) FINISHED
 => [base 1/2] FROM docker.io/library/node:18-alpine@sha256:c7c2...        0.0s
 => CACHED [base 2/2] WORKDIR /app                                         0.0s
 => CACHED [deps 1/2] COPY package.json package-lock.json ./               0.0s
 => CACHED [deps 2/2] RUN npm ci                                           0.0s
 => CACHED [build 1/2] COPY . .                                            0.0s
 => CACHED [build 2/2] RUN npm run build                                   0.0s
 => [final 1/2] COPY --from=build /app/dist /usr/share/nginx/html          0.1s
 => [final 2/2] EXPOSE 80                                                  0.0s
 => exporting to image                                                     0.1s

# Legacy (non-BuildKit) output
Successfully built f2e...
Successfully tagged myapp:latest
Warning: Community filters are third-party code. Review the filter definition above before installing it in production environments.
Browse all filters