专属域名
文档搜索
轩辕助手
Run助手
邀请有礼
返回顶部
快速返回页面顶部
收起
收起工具栏
轩辕镜像 官方专业版
轩辕镜像
专业版
轩辕镜像 官方专业版
轩辕镜像
专业版
首页个人中心搜索镜像

交易
充值流量我的订单
工具
提交工单镜像收录一键安装
Npm 源Pip 源Homebrew 源
帮助
常见问题轩辕镜像免费版
其他
关于我们网站地图
热门搜索:
dockerfile

docker/dockerfile

Docker 官方工具与组件镜像

这些是官方提供的Dockerfile前端镜像,主要功能是支持通过BuildKit构建Dockerfile,作为构建流程中的关键前端工具,能够有效配合BuildKit提升Dockerfile的构建效率、安全性与灵活性,为开发者提供官方认可的标准化构建方案,适用于各类基于Docker的应用开发与部署场景,确保构建过程的稳定可靠及操作便捷性。

124 次收藏下载次数: 0状态:社区镜像维护者:Docker 官方工具与组件镜像仓库类型:镜像最近更新:17 天前
轩辕镜像,不浪费每一次拉取。点击查看
DockerHub 官方简介
轩辕镜像中文简介
标签下载
镜像标签列表与下载命令
轩辕镜像,不浪费每一次拉取。点击查看

BuildKit Dockerfile frontend

Official Dockerfile frontend images that enable building Dockerfiles with BuildKit.

Report issues at https://github.com/moby/buildkit

Join #buildkit channel on Docker Community Slack

Tags

Latest releases

  • https://github.com/moby/buildkit/blob/dockerfile/1.23.0/frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile

  • https://github.com/moby/buildkit/blob/dockerfile/1.22.0/frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile

  • https://github.com/moby/buildkit/blob/dockerfile/1.21.0/frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile

  • https://github.com/moby/buildkit/blob/dockerfile/1.20.0/frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile

Latest labs releases

  • https://github.com/moby/buildkit/blob/dockerfile/1.23.0/frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile

  • https://github.com/moby/buildkit/blob/dockerfile/1.22.0-labs/frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile

Development build from master branch

  • https://github.com/moby/buildkit/blob/dockerfile/master/frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile

  • https://github.com/moby/buildkit/blob/dockerfile/master/frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile

Note for Docker users

If you are using Docker v18.09 or later, BuildKit mode can be enabled by setting export DOCKER_BUILDKIT=1 on the client side.

https://github.com/docker/buildx always enables BuildKit.

Using external Dockerfile frontend

BuildKit supports loading frontends dynamically from container images. Images for Dockerfile frontends are available at https://hub.docker.com/r/docker/dockerfile/tags/ repository.

To use the external frontend, the first line of your Dockerfile needs to be # syntax=docker/dockerfile:1.3 pointing to the specific image you want to use.

BuildKit also ships with Dockerfile frontend builtin but it is recommended to use an external image to make sure that all users use the same version on the builder and to pick up bugfixes automatically without waiting for a new version of BuildKit or Docker engine.

The images are published on two channels: latest and labs. The latest channel uses semver versioning while labs uses an https://github.com/moby/buildkit/issues/528. This means the labs channel may remove a feature without incrementing the major component of a version and you may want to pin the image to a specific revision. Even when syntaxes change in between releases on labs channel, the old versions are guaranteed to be backward compatible.

Linked copies COPY --link, ADD --link

To use this flag set Dockerfile version to at least 1.4.

dockerfile
# syntax=docker/dockerfile:1.4

Enabling this flag in COPY or ADD commands allows you to copy files with enhanced semantics where your files remain independent on their own layer and don't get invalidated when commands on previous layers are changed.

When --link is used your source files are copied into an empty destination directory. That directory is turned into a layer that is linked on top of your previous state.

dockerfile
# syntax=docker/dockerfile:1.4
FROM alpine
COPY --link /foo /bar

Is equivalent of doing two builds:

dockerfile
FROM alpine

and

dockerfile
FROM scratch
COPY /foo /bar

and merging all the layers of both images together.

Benefits of using --link

Using --link allows to reuse already built layers in subsequent builds with --cache-from even if the previous layers have changed. This is especially important for multi-stage builds where a COPY --from statement would previously get invalidated if any previous commands in the same stage changed, causing the need to rebuild the intermediate stages again. With --link the layer the previous build generated is reused and merged on top of the new layers. This also means you can easily rebase your images when the base images receive updates, without having to execute the whole build again. In backends that support it, BuildKit can do this rebase action without the need to push or pull any layers between the client and the registry. BuildKit will detect this case and only create new image manifest that contains the new layers and old layers in correct order.

The same behavior where BuildKit can avoid pulling down the base image can also happen when using --link and no other commands that would require access to the files in the base image. In that case BuildKit will only build the layers for the COPY commands and push them to the registry directly on top of the layers of the base image.

Incompatibilities with --link=false

When using --link the COPY/ADD commands are not allowed to read any files from the previous state. This means that if in previous state the destination directory was a path that contained a symlink, COPY/ADD can not follow it. In the final image the destination path created with --link will always be a path containing only directories.

If you don't rely on the behavior of following symlinks in the destination path, using --link is always recommended. The performance of --link is equivalent or better than the default behavior and it creates much better conditions for cache reuse.

Build Mounts RUN --mount=...

To use this flag set Dockerfile version to at least 1.2

# syntax=docker/dockerfile:1.3

RUN --mount allows you to create mounts that process running as part of the build can access. This can be used to bind files from other part of the build without copying, accessing build secrets or ssh-agent sockets, or creating cache locations to speed up your build.

RUN --mount=type=bind (the default mount type)

This mount type allows binding directories (read-only) in the context or in an image to the build container.

OptionDescription
target (required)Mount path.
sourceSource path in the from. Defaults to the root of the from.
fromBuild stage or image name for the root of the source. Defaults to the build context.
rw,readwriteAllow writes on the mount. Written data will be discarded.

RUN --mount=type=cache

This mount type allows the build container to cache directories for compilers and package managers.

OptionDescription
idOptional ID to identify separate/different caches. Defaults to value of target.
target (required)Mount path.
ro,readonlyRead-only if set.
sharingOne of shared, private, or locked. Defaults to shared. A shared cache mount can be used concurrently by multiple writers. private creates a new mount if there are multiple writers. locked pauses the second writer until the first one releases the mount.
fromBuild stage to use as a base of the cache mount. Defaults to empty directory.
sourceSubpath in the from to mount. Defaults to the root of the from.
modeFile mode for new cache directory in octal. Default 0755.
uidUser ID for new cache directory. Default 0.
gidGroup ID for new cache directory. Default 0.

Contents of the cache directories persists between builder invocations without invalidating the instruction cache. Cache mounts should only be used for better performance. Your build should work with any contents of the cache directory as another build may overwrite the files or GC may clean it if more storage space is needed.

Example: cache Go packages

dockerfile
# syntax = docker/dockerfile:1.3
FROM golang
...
RUN --mount=type=cache,target=/root/.cache/go-build go build ...

Example: cache apt packages

dockerfile
# syntax = docker/dockerfile:1.3
FROM ubuntu
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \
  apt update && apt-get --no-install-recommends install -y gcc

RUN --mount=type=tmpfs

This mount type allows mounting tmpfs in the build container.

OptionDescription
target (required)Mount path.
sizeSpecify an upper limit on the size of the filesystem.

RUN --mount=type=secret

This mount type allows the build container to access secure files such as private keys without baking them into the image.

OptionDescription
idID of the secret. Defaults to basename of the target path.
targetMount path. Defaults to /run/secrets/ + id.
requiredIf set to true, the instruction errors out when the secret is unavailable. Defaults to false.
modeFile mode for secret file in octal. Default 0400.
uidUser ID for secret file. Default 0.
gidGroup ID for secret file. Default 0.

Example: access to S3

dockerfile
# syntax = docker/dockerfile:1.3
FROM python:3
RUN pip install awscli
RUN --mount=type=secret,id=aws,target=/root/.aws/credentials aws s3 cp s3://... ...
console
$ docker build --secret id=aws,src=$HOME/.aws/credentials .
console
$ buildctl build --frontend=dockerfile.v0 --local context=. --local dockerfile=. \
  --secret id=aws,src=$HOME/.aws/credentials

RUN --mount=type=ssh

This mount type allows the build container to access SSH keys via SSH agents, with support for passphrases.

OptionDescription
idID of SSH agent socket or key. Defaults to "default".
targetSSH agent socket path. Defaults to /run/buildkit/ssh_agent.${N}.
requiredIf set to true, the instruction errors out when the key is unavailable. Defaults to false.
modeFile mode for socket in octal. Default 0600.
uidUser ID for socket. Default 0.
gidGroup ID for socket. Default 0.

Example: access to Gitlab

dockerfile
# syntax = docker/dockerfile:1.3
FROM alpine
RUN apk add --no-cache openssh-client
RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
RUN --mount=type=ssh ssh -q -T git@gitlab.com 2>&1 | tee /hello
# "Welcome to GitLab, @GITLAB_USERNAME_ASSOCIATED_WITH_SSHKEY" should be printed here
# with the type of build progress is defined as `plain`.
console
$ eval $(ssh-agent)
$ ssh-add ~/.ssh/id_rsa
(Input your passphrase here)
$ docker build --ssh default=$SSH_AUTH_SOCK .
$ buildctl build --frontend=dockerfile.v0 --local context=. --local dockerfile=. \
  --ssh default=$SSH_AUTH_SOCK

You can also specify a path to *.pem file on the host directly instead of $SSH_AUTH_SOCK. However, pem files with passphrases are not supported.

Network modes RUN --network=none|host|default

# syntax=docker/dockerfile:1.3

RUN --network allows control over which networking environment the command is run in.

The allowed values are:

  • none - The command is run with no network access (lo is still available, but is isolated to this process)
  • host - The command is run in the host's network environment (similar to docker build --network=host, but on a per-instruction basis)
  • default - Equivalent to not supplying a flag at all, the command is run in the default network for the build

The use of --network=host is protected by the network.host entitlement, which needs to be enabled when starting the buildkitd daemon (--allow-insecure-entitlement network.host) and on the build request (--allow network.host).

Example: isolating external effects

dockerfile
# syntax = docker/dockerfile:1.3
FROM python:3.6
ADD mypackage.tgz wheels/
RUN --network=none pip install --find-links wheels mypackage

pip will only be able to install the packages provided in the tarfile, which can be controlled by an earlier build stage.

Here-Documents

This feature is available since docker/dockerfile:1.4.0 release.

# syntax=docker/dockerfile:1.4

Here-documents allow redirection of subsequent Dockerfile lines to the input of RUN or COPY commands. If such command contains a here-document Dockerfile will *** the next lines until the line only containing a here-doc delimiter as part of the same command.

Example: running a multi-line script

dockerfile
# syntax = docker/dockerfile:1.4
FROM debian
RUN <<eot bash
  apt-get update
  apt-get install -y vim
eot

If the command only contains a here-document, its contents is evaluated with the default shell.

dockerfile
# syntax = docker/dockerfile:1.4
FROM debian
RUN <<eot
  mkdir -p foo/bar
eot

Alternatively, shebang header can be used to define an interpreter.

dockerfile
# syntax = docker/dockerfile:1.4
FROM python:3.6
RUN <<eot
#!/usr/bin/env python
print("hello world")
eot

More complex examples may use multiple here-documents.

dockerfile
# syntax = docker/dockerfile:1.4
FROM alpine
RUN <<FILE1 cat > file1 && <<FILE2 cat > file2
I am
first
FILE1
I am
second
FILE2

Example: creating inline files

In COPY commands source parameters can be replaced with here-doc indicators. Regular here-doc variable expansion and tab stripping rules apply.

dockerfile
# syntax = docker/dockerfile:1.4
FROM alpine
ARG FOO=bar
COPY <<-eot /app/foo
	hello ${FOO}
eot
dockerfile
# syntax = docker/dockerfile:1.4
FROM alpine
COPY <<-"eot" /app/script.sh
	echo hello ${FOO}
eot
RUN FOO=abc ash /app/script.sh

Security context RUN --security=insecure|sandbox

To use this flag, set Dockerfile version to labs channel.

# syntax=docker/dockerfile:1.3-labs

With --security=insecure, builder runs the command without sandbox in insecure mode, which allows to run flows requiring elevated privileges (e.g. containerd). This is equivalent to running docker run --privileged. In order to access this feature, entitlement security.insecure should be enabled when starting the buildkitd daemon (--allow-insecure-entitlement security.insecure) and for a build request (--allow security.insecure).

Default sandbox mode can be activated via --security=sandbox, but that is no-op.

Example: check entitlements

dockerfile
# syntax = docker/dockerfile:1.3-labs
FROM ubuntu
RUN --security=insecure cat /proc/self/status | grep CapEff
#84 0.093 CapEff:	0000003fffffffff

更多相关 Docker 镜像与资源

以下是 docker/dockerfile 相关的常用 Docker 镜像,适用于 不同场景 等不同场景:

  • library/docker Docker 镜像说明

镜像拉取方式

您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

轩辕镜像加速拉取命令点我查看更多 dockerfile 镜像标签

docker pull docker.xuanyuan.run/docker/dockerfile:<标签>

使用方法:

  • 登录认证方式
  • 免认证方式

DockerHub 原生拉取命令

docker pull docker/dockerfile:<标签>

更多 dockerfile 镜像推荐

tonistiigi/dockerfile logo

tonistiigi/dockerfile

tonistiigi
BuildKit是Moby项目的高效Docker镜像构建工具,提供快速灵活的构建能力,支持增量、并行构建及缓存优化,用于改进Docker构建流程。
3 次收藏10万+ 次下载
7 个月前更新
crazymax/dockerfile logo

crazymax/dockerfile

crazymax
暂无描述
5万+ 次下载
6 个月前更新
docker/dockerfile-upstream logo

docker/dockerfile-upstream

Docker 官方工具与组件镜像
Docker Dockerfile的预发布版本,用于开发和测试阶段的Dockerfile相关功能验证与体验。
12 次收藏1000万+ 次下载
1 天前更新
nobidev/dockerfile logo

nobidev/dockerfile

nobidev
暂无描述
1万+ 次下载
2 年前更新

查看更多 dockerfile 相关镜像

轩辕镜像配置手册

探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式

Docker 配置

登录仓库拉取

通过 Docker 登录认证访问私有仓库

专属域名拉取

无需登录使用专属域名

K8s Containerd

Kubernetes 集群配置 Containerd

K3s

K3s 轻量级 Kubernetes 镜像加速

Dev Containers

VS Code Dev Containers 配置

Podman

Podman 容器引擎配置

Singularity/Apptainer

HPC 科学计算容器配置

其他仓库配置

ghcr、Quay、nvcr 等镜像仓库

Harbor 镜像源配置

Harbor Proxy Repository 对接专属域名

Portainer 镜像源配置

Portainer Registries 加速拉取

Nexus 镜像源配置

Nexus3 Docker Proxy 内网缓存

系统配置

Linux

在 Linux 系统配置镜像服务

Windows/Mac

在 Docker Desktop 配置镜像

MacOS OrbStack

MacOS OrbStack 容器配置

Docker Compose

Docker Compose 项目配置

NAS 设备

群晖

Synology 群晖 NAS 配置

飞牛

飞牛 fnOS 系统配置镜像

绿联

绿联 NAS 系统配置镜像

威联通

QNAP 威联通 NAS 配置

极空间

极空间 NAS 系统配置服务

网络设备

爱快路由

爱快 iKuai 路由系统配置

宝塔面板

在宝塔面板一键配置镜像

需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单

镜像拉取常见问题

使用与功能问题

配置了专属域名后,docker search 为什么会报错?

docker search 限制

Docker Hub 上有的镜像,为什么在轩辕镜像网站搜不到?

站内搜不到镜像

机器不能直连外网时,怎么用 docker save / load 迁镜像?

离线 save/load

docker pull 拉插件报错(plugin v1+json)怎么办?

插件要用 plugin install

WSL 里 Docker 拉镜像特别慢,怎么排查和优化?

WSL 拉取慢

轩辕镜像安全吗?如何用 digest 校验镜像没被篡改?

安全与 digest

第一次用轩辕镜像拉 Docker 镜像,要怎么登录和配置?

新手拉取配置

轩辕镜像合规吗?轩辕镜像的合规是怎么做的?

镜像合规机制

错误码与失败问题

docker pull 提示 manifest unknown 怎么办?

manifest unknown

docker pull 提示 no matching manifest 怎么办?

no matching manifest(架构)

镜像已拉取完成,却提示 invalid tar header 或 failed to register layer 怎么办?

invalid tar header(解压)

Docker pull 时 HTTPS / TLS 证书验证失败怎么办?

TLS 证书失败

Docker pull 时 DNS 解析超时或连不上仓库怎么办?

DNS 超时

docker 无法连接轩辕镜像域名怎么办?

域名连通性排查

Docker 拉取出现 410 Gone 怎么办?

410 Gone 排查

出现 402 或「流量用尽」提示怎么办?

402 与流量用尽

Docker 拉取提示 UNAUTHORIZED(401)怎么办?

401 认证失败

遇到 429 Too Many Requests(请求太频繁)怎么办?

429 限流

docker login 提示 Cannot autolaunch D-Bus,还算登录成功吗?

D-Bus 凭证提示

为什么会出现「单层超过 20GB」或 413,无法加速拉取?

413 与超大单层

账号 / 计费 / 权限

轩辕镜像免费版和专业版有什么区别?

免费版与专业版区别

轩辕镜像支持哪些 Docker 镜像仓库?

支持的镜像仓库

镜像拉取失败还会不会扣流量?

失败是否计费

麒麟 V10 / 统信 UOS 提示 KYSEC 权限不够怎么办?

KYSEC 拦截脚本

如何在轩辕镜像申请开具发票?

申请开票

怎么修改轩辕镜像的网站登录和仓库登录密码?

修改登录密码

如何注销轩辕镜像账户?要注意什么?

注销账户

配置与原理类

写了 registry-mirrors,为什么还是走官方或仍然报错?

mirrors 不生效

怎么用 docker tag 去掉镜像名里的轩辕域名前缀?

去掉域名前缀

如何拉取指定 CPU 架构的镜像(如 ARM64、AMD64)?

指定架构拉取

用轩辕镜像拉镜像时快时慢,常见原因有哪些?

拉取速度原因

查看全部问题→

用户好评

来自真实用户的反馈,见证轩辕镜像的优质服务

用户头像

oldzhang

运维工程师

Linux服务器

5

"Docker访问体验非常流畅,大镜像也能快速完成下载。"

轩辕镜像
Docker 官方工具与组件镜像
...
docker/dockerfile
博客Docker 镜像公告与技术博客
热门查看热门 Docker 镜像推荐
安装一键安装 Docker 并配置镜像源
镜像拉取问题咨询请 提交工单,官方技术交流群:1072982923。轩辕镜像所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
镜像拉取问题咨询请提交工单,官方技术交流群:。轩辕镜像所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
商务合作:点击复制邮箱
©2024-2026 源码跳动
商务合作:点击复制邮箱Copyright © 2024-2026 杭州源码跳动科技有限公司. All rights reserved.