Creating Functions

Find out about creating functions in OCI Functions, including image-based functions and code-only functions.

You can create a new function definition in the OCI Functions server in different ways, depending on how you want to provide the function source:

When creating an image-based function from an existing Docker image, you specify function metadata to store in the OCI Functions server. For example, the maximum length of time the function is allowed to execute for.

The existing image on which you base a new image-based function must be suitable for use with OCI Functions. Typically, to build and push a suitable image, you or somebody else will use Fn Project CLI commands and/or Docker CLI commands. For example, having written your function code and a func.yaml file containing function metadata (perhaps based on the template helloworld function and func.yaml created using fn init), you can:

  • Use fn build to build a new Docker image from the function.
  • Use docker push to push the image to the Docker registry.

With the image in the Docker registry, you can then use the Console, a CLI command, or an API operation to create an image-based function from the image, as described in this topic.

See Creating an Image-Based Function from an Existing Image.