capabilities.work

Build, Tag, and Push an Image

A 5-step recipe with Docker. We can help you get access.

Recipe · 5 steps

Build, Tag, and Push an Image

with Docker

Build an image from a context, tag it for a registry, and push it.

  1. Validate the registry credentials up front so an authentication problem fails the flow in seconds rather than after a full image build.
  2. Build the image from the supplied tar context using the BuildKit backend, removing intermediate containers and applying the local build tag.
  3. Inspect the freshly built image to confirm it landed in the local store and to capture its id and digests for the build record.
  4. Create the registry-qualified tag that references the built image. The push endpoint requires the image to already carry a name that points at the target registry.
  5. Push the tagged image to the registry using the supplied auth configuration.
What you'll need to have ready
  • username: Registry username to validate before building.
  • password: Registry password or token.
  • serveraddress: Registry address (e.g. "https://index.docker.io/v1/").
  • buildContext: The build context as a tar archive (identity, gzip, bzip2, or xz).
  • localTag: Local name and tag to apply at build time, in "name:tag" form.
  • repo: The repository to tag into for the push (e.g. "someuser/someimage").
  • tag: The tag name to apply and push (e.g. "latest").
  • registryAuth: Base64url-encoded auth configuration used for the push.
  • dockerfile: Path to the Dockerfile within the build context.
  • buildargs: JSON map of build-time variables, URI component encoded.
  • registryConfig: Base64-encoded JSON of multi-registry auth configurations used during the build.
For your developer

Arazzo workflow docker:build-and-push-image, 5 operations: SystemAuth → ImageBuild → ImageInspect → ImageTag → ImagePush. Specs on APIs.io.