Skip to content
Latchkey

skaffold build Command Reference

Build and push the images defined in skaffold.yaml.

skaffold build builds and tags every artifact in your config and pushes them to a registry, without deploying. Writing the build output to a file lets a separate deploy step reuse the exact tags.

What it does

skaffold build builds each artifact, applies the tagging policy, and pushes the images. With --file-output it records the resolved image references so skaffold deploy --build-artifacts can deploy precisely those images.

Common flags and usage

  • --file-output FILE: write built image references to a JSON file
  • --push: push images to the registry (default in CI contexts)
  • --default-repo REPO: target registry for pushed images
  • -p / --profile NAME: activate a build profile
  • --tag TAG: override the tagging policy with an explicit tag

Example

shell
- name: Skaffold build
  run: |
    skaffold build --push \
      --default-repo "${REGISTRY}" \
      --file-output=build.json

- name: Skaffold deploy
  run: skaffold deploy --build-artifacts=build.json --profile prod

In CI

Split build and deploy: skaffold build --file-output writes the resolved image tags, and a later skaffold deploy --build-artifacts consumes them so the deployed images match what was built and scanned. Always --push to a --default-repo the cluster can pull from.

Key takeaways

  • skaffold build builds, tags, and pushes images without deploying.
  • --file-output records image refs for a later skaffold deploy step.
  • Splitting build from deploy guarantees the deployed image was the built one.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →