Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.

Chapter 5. Building functions


To run a function, you first must build the function project. This happens automatically when using the kn func run command, but you can also build a function without running it.

5.1. Building a function

Before you can run a function, you must build the function project. When you run the kn func run command, the system builds the function automatically. However, you can use the kn func build command to build a function without running it, which can be useful for advanced users or debugging scenarios.

You can run the kn func build command to create an OCI container image that you can run locally on your computer or on an OpenShift Container Platform cluster. This command uses the function project name and the image registry name to construct a fully qualified image name for your function.

5.1.1. Image container types

By default, kn func build creates a container image by using Red Hat Source-to-Image (S2I) technology.

You can build a function by using Red Hat Source-to-Image (S2I):

$ kn func build

5.1.2. Image registry types

By default, the system stores function images in the OpenShift Container Registry.

You can build a function by using the OpenShift Container Registry:

$ kn func build

You get an output similar to the following example:

Building function image
Function image has been built, image: registry.redhat.io/example/example-function:latest

You can override using OpenShift Container Registry as the default image registry by using the --registry flag:

$ kn func build --registry quay.io/username

You get an output similar to the following example:

Building function image
Function image has been built, image: quay.io/username/example-function:latest

5.1.3. Push flag

You can add the --push flag to a kn func build command to automatically push the function image after it is successfully built:

$ kn func build --push

5.1.4. Help command

You can use the help command to learn more about kn func build command options:

$ kn func help build
Red Hat logoGithubredditYoutubeTwitter

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat Dokumentation

Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können. Entdecken Sie unsere neuesten Updates.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

Theme

© 2026 Red Hat
Nach oben