百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

docker-show-context

> 编程语言
开源

显示在上下文上传“ Docker 构建” 时浪费的时间

345 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

显示在上下文上传“ Docker 构建” 时浪费的时间

docker-show-context

Ever wonder why docker pauses when you do docker build, and what you can do about it? You know, when it says Sending build context to Docker daemon?

This program shows where time and bytes are spent when building a docker context.

It is based directly on the same logic that Docker itself uses to build the context.

Getting started (docker):

bash
docker build -t docker-show-context https://github.com/pwaller/docker-show-context.git
docker run --rm -v $PWD:/data docker-show-context

Getting started (binaries):

Binaries are available on the releases page. Just grab the binary and put it in your path, then invoke it as docker-show-context. Use at your own risk.

Getting started (building from source):

You will need go 1.11 or more recent, which can be obtained from the go website.

Then run:

bash
git clone https://github.com/pwaller/docker-show-context
cd docker-show-context
GO111MODULE=on go install -v

What the output looks like

The output looks something like this. It's easy to see now that I accidentally included some large binary content (*.deb and *.pdf files in particular), so I can now go and add those to my .dockerignore or delete them.

…

Notes about the current behaviour

This documents the current behaviour, which may not be ideal, but it is what it is for now. Pull requests welcome.

  • The amounts shown don't show recursive usage, they just show a single level of the directory. (Otherwise, the root would always be the biggest thing).

  • Time records the amount of time between tarFile.Next() calls. I assume that this approximates the amount of time docker/pkg/archive spent constructing one tar entry. It might not be precise.

  • "Total content" shows the uncompressed bytes inside files inside the tar. The total amount sent to the docker daemon is this amount plus the tar overhead.

  • At this moment, only running with the build context root as the current working directory is supported, with a dockerfile named Dockerfile. Pull requests welcome to add parameters, so long as the existing default behaviour is preserved.

How can I use this to make building faster?

Frequently, I find that docker build suddenly takes longer than I expect. It is often the case that I have accidentally included some binaries or something which I did not intend to include. This the purpose of this tool is to give visibility into this, taking into account your existing .dockerignore, so that you can improve your .dockerfile or delete assets you don't need.

It scratches an itch.

License

The MIT License (MIT)

Copyright (c) 2016-2018 Peter Waller

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Go

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言