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

Chapter 3. Running functions locally


You can run a function locally by using the kn func tool. This can be useful, for example, for testing the function before deploying it to the cluster.

3.1. Running a function locally

You can run a function locally by using the kn func run command in the current directory or by specifying a directory with the --path flag.

If you run the function for the first time, or if you change the project files, the kn func run command builds the function before running it.

You can run a function in the current directory by using the following command:

$ kn func run

You can run a function in a specific directory by specifying the path with the --path flag:

$ kn func run --path=<directory_path>

You can also force a rebuild of an existing image before running the function, even if there have been no changes to the project files, by using the --build flag:

You can run a function and trigger a build by using the --build flag:

$ kn func run --build

If you set the build flag as false, this disables building of the image, and runs the function by using the previously built image:

You can run a function without building it by using the --build=false flag:

$ kn func run --build=false

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

Build help command

$ kn func help run

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