Build and push a container image
Build a container image from a Dockerfile with BuildKit and push it to a registry, using a Docker config.json read from a Kubernetes Secret.
Install v2.0.0
Installs the template into your Argo namespace. The URL is pinned to this version.
kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/docker-build-push/2.0.0/template.yaml
Or with the Argo CLI:
argo template create -n argo https://catalog.dagweave.com/api/v1/items/docker-build-push/2.0.0/template.yaml
Facts
- Category
- CI/CD
- Tags
- buildkit ci-cd
- Entrypoint
build- Template SHA-256
e785d25299e9823d5b79e33df5daaab16993dbd4e83d90d19376387cca735160- Source
- docker-build-push at catalog commit 67458f7
- API
- item document, latest template.yaml
Images and provenance
Every image is pinned by digest, so a rebuilt tag can never change what this version runs.
| Repository | Tag | Digest |
|---|---|---|
moby/buildkit | v0.34.1-rootless | sha256:f68752a5a94acfcdad2d07867b7075601a421638e17fc5f28efc1c814d0c4f89 |
Parameters
| Name | Description | Default |
|---|---|---|
context required |
A directory BuildKit can read, or a git/HTTP URL it can fetch. A git URL carries its branch and subdirectory as a #ref:subdir fragment. Example /work |
none |
destination required |
Fully-qualified destination image reference to push (registry/repo:tag). Example ghcr.io/org/app:1.2.3 |
none |
docker-config-secret-key |
Key within the Secret that holds the Docker config.json. | .dockerconfigjson |
docker-config-secret-name |
Name of the Kubernetes Secret holding the registry Docker config.json. | docker-config |
dockerfile |
Path to the Dockerfile, relative to the context root. | Dockerfile |
push |
Set to false to build the image and keep it in the builder without pushing it anywhere. One of true, false |
true |
WorkflowTemplate
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: docker-build-push
labels:
dagweave.io/catalog-item: docker-build-push
annotations:
# The catalog semver this manifest was authored at. The dagweave app records
# (catalog-item-id, semver) -> content-hash -> base-vN when it mints the tenant
# cluster name via ResolveOrMint. Keep in sync with metadata.yaml `version`.
dagweave.io/catalog-version: "2.0.0"
dagweave.io/catalog-category: "CI/CD"
spec:
entrypoint: build
# Registry credentials are a Docker config.json mounted at $DOCKER_CONFIG, which is
# where buildctl looks for auth. The Secret is a standard kubernetes.io/dockerconfigjson
# (or any Secret whose key holds a Docker config).
volumes:
- name: docker-config
secret:
secretName: "{{inputs.parameters.docker-config-secret-name}}"
items:
- key: "{{inputs.parameters.docker-config-secret-key}}"
path: config.json
templates:
- name: build
inputs:
parameters:
# A directory in the container, or a git/HTTP URL. A git URL carries its branch
# and subdirectory as a `#ref:subdir` fragment rather than in separate flags.
- name: context
# Path to the Dockerfile, relative to the context root.
- name: dockerfile
default: Dockerfile
# Fully-qualified destination image reference to push (registry/repo:tag).
- name: destination
# "false" builds the image and keeps it in the builder, pushing nothing.
- name: push
default: "true"
# Name of the Kubernetes Secret holding the registry Docker config.json.
# Defaults let a user leave them blank in the Inspector.
- name: docker-config-secret-name
default: docker-config
- name: docker-config-secret-key
default: .dockerconfigjson
container:
# Pinned by digest per the catalog convention: an image rebuild can never
# silently change the behaviour of an already-released item version.
# moby/buildkit:v0.34.1-rootless
image: moby/buildkit@sha256:f68752a5a94acfcdad2d07867b7075601a421638e17fc5f28efc1c814d0c4f89
command: [sh, -c]
# Values arrive as env vars (below) and are never interpolated from Argo into the
# shell, so a context or tag holding quotes or metacharacters is safe. The if is
# because buildkit names a local context with --local and a remote one with --opt.
args:
- |
set -eu
if [ -d "$CONTEXT" ]; then
set -- --local "context=$CONTEXT" --local "dockerfile=$CONTEXT"
else
set -- --opt "context=$CONTEXT"
fi
buildctl-daemonless.sh build \
--frontend dockerfile.v0 \
--opt "filename=$DOCKERFILE" \
"$@" \
--output "type=image,name=$DESTINATION,push=$PUSH"
env:
- name: CONTEXT
value: "{{inputs.parameters.context}}"
- name: DOCKERFILE
value: "{{inputs.parameters.dockerfile}}"
- name: DESTINATION
value: "{{inputs.parameters.destination}}"
- name: PUSH
value: "{{inputs.parameters.push}}"
# buildctl reads registry auth from $DOCKER_CONFIG/config.json.
- name: DOCKER_CONFIG
value: /docker-config
# Rootless buildkitd cannot nest a second sandbox inside an unprivileged pod.
- name: BUILDKITD_FLAGS
value: --oci-worker-no-process-sandbox
# buildctl-daemonless.sh starts buildkitd in this pod and polls for it,
# sleeping (100 + try*20)ms and giving up at try > max with exit 1. The
# image defaults max to 10, which is eleven sleeps and 2.2 SECONDS in
# total. A quiet cluster beats that; a busy one does not, which is why
# this item passed 6/6 alone and failed intermittently inside full runs.
# 60 is 61 sleeps and about 43 seconds. A daemon that has genuinely not
# started still fails, 40 seconds later than it used to.
- name: BUILDCTL_CONNECT_RETRIES_MAX
value: "60"
# Rootless buildkit unshares a user namespace, which the default seccomp and
# AppArmor profiles block. Nothing privileged and no added capability, but
# Unconfined is more than kaniko needed and PodSecurity `restricted` forbids it.
securityContext:
runAsUser: 1000
runAsGroup: 1000
seccompProfile:
type: Unconfined
appArmorProfile:
type: Unconfined
volumeMounts:
- name: docker-config
mountPath: /docker-config
Version history
Read from the item's changelog. Each version has its own JSON document; the pinned catalogue vendors the manifest of the latest one, so that is the version that installs.
-
2.0.0 latest 2026-08-06
Replace Kaniko with rootless BuildKit. Google archived kaniko, so its 112 fixable CRITICAL/HIGH (5 CRITICAL) could never come down; BuildKit v0.32.2 measures 64, none CRITICAL, and ships often enough for that to move. Breaking on three counts, hence the major. A context is now a directory or a git/HTTP URL, so kaniko's s3://, gs:// and dir:// contexts are gone and its git:// prefix now means the git wire protocol rather than "clone over HTTPS"; a git subdirectory rides in the URL fragment as `#ref:subdir` where kaniko took a separate --context-sub-path. The container needs Unconfined seccomp and AppArmor to unshare a user namespace, which kaniko did not, so it will not admit into a namespace enforcing PodSecurity `restricted`. New `push` parameter, default "true", standing in for kaniko's --no-push.
kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/docker-build-push/2.0.0/template.yamlargo template create -n argo https://catalog.dagweave.com/api/v1/items/docker-build-push/2.0.0/template.yaml -
1.0.1 2026-08-02
Move kaniko from v1.23.2 to v1.24.0, the newest release. Fixable CRITICAL/HIGH only drops from 116 to 112: kaniko has shipped nothing since May 2025, so clearing the rest needs a different build tool rather than another bump.
This release is documented, but its manifest is not vendored here, so it has no install command. Version document
-
1.0.0 2026-07-17
Initial release.
This release is documented, but its manifest is not vendored here, so it has no install command. Version document
Run it once
After installing, from the command line.
argo submit -n argo --from workflowtemplate/docker-build-push \
-p context=/work \
-p destination=ghcr.io/org/app:1.2.3
Workflow that references it
A Workflow with the required parameters filled from the examples.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: docker-build-push-
spec:
workflowTemplateRef:
name: docker-build-push
arguments:
parameters:
- name: context
value: "/work"
- name: destination
value: "ghcr.io/org/app:1.2.3"
As a step of a larger workflow
steps:
- - name: docker-build-push
templateRef:
name: docker-build-push
template: build