In the same spirit as [building local binaries](#building-local-binaries), you can build local docker images instead of local binaries.
Currently, we are supporting two build systems:
- [Building local images with docker](#building-local-images-with-docker)
- [Building local images with ko](#building-local-images-with-ko)
> **Note**: We started with `docker` and are progressively moving to `ko`.
As the `ko` based build system matures, we will deprecate and remove `docker` based builds.
Choosing between `docker` and `ko` boils down to a prefix when invoking `make` targets.
For example:
-`make docker-build-kyverno` creates a docker image using the `docker` build system
-`make ko-build-kyverno` creates a docker image using the `ko` build system
<!-- TODO: explain the way images are tagged. -->
### Building local images with docker
When building local images with docker you can specify the registry used to create the image names by setting the `REGISTRY` environment variable (default value is `ghcr.io`).
> **Note**: You can build all local images at once by running `make docker-build-all`.
#### Building kyvernopre image locally
To build `kyvernopre` image on your local system, run:
```console
make docker-build-kyvernopre
```
The resulting image should be available locally, named `ghcr.io/kyverno/kyvernopre` (by default, if `REGISTRY` environment variable was not set).
#### Building kyverno image locally
To build `kyverno` image on your local system, run:
```console
make docker-build-kyverno
```
The resulting image should be available locally, named `ghcr.io/kyverno/kyverno` (by default, if `REGISTRY` environment variable was not set).
#### Building cli image locally
To build `cli` image on your local system, run:
```console
make docker-build-cli
```
The resulting image should be available locally, named `ghcr.io/kyverno/kyverno-cli` (by default, if `REGISTRY` environment variable was not set).
### Building local images with ko
When building local images with ko you can't specify the registry used to create the image names. It will always be `ko.local`.
> **Note**: You can build all local images at once by running `make ko-build-all`.
#### Building kyvernopre image locally
To build `kyvernopre` image on your local system, run:
```console
make ko-build-kyvernopre
```
The resulting image should be available locally, named `ko.local/github.com/kyverno/kyverno/cmd/initcontainer`.
#### Building kyverno image locally
To build `kyverno` image on your local system, run:
```console
make ko-build-kyverno
```
The resulting image should be available locally, named `ko.local/github.com/kyverno/kyverno/cmd/kyverno`.
#### Building cli image locally
To build `cli` image on your local system, run:
```console
make ko-build-cli
```
The resulting image should be available locally, named `ko.local/github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno`.