You need to enable JavaScript to run this app.
Volcano Engine Function as a Service

Volcano Engine Function as a Service

Copy page
Download PDF
Native runtime
Image-based deployment
Copy page
Download PDF
Image-based deployment
Native functions support two deployment methods: using code packages and using images. For image-based deployments, you need to write a Dockerfile to assemble your code package into an image and upload the image to CR in the same Volcano Engine region as the function. This topic describes how to build an image.​
Background information​
Image-based deployment includes the following steps:​
  1. Build an image: You need to write a Dockerfile to assemble your code package into an image, and upload the image to CR in the same Volcano Engine region where you want to deploy the function.​
  1. Create the function: veFaaS assumes the service role for the function to pull the image from Volcano Engine Container Registry. After the image is pulled, it is synchronized to veFaaS.​
  1. Release the function: After the specified image version is released, the current service takes over all requests.​
Prerequisites​
Volcano Engine CR has been activated. A CR instance has been created with a password set. A namespace and OCI artifact repository have been created. For detailed steps, see Getting Started with CR.​
Limits​
  • Requirements for HTTP services​
  • Your service must provide a startup script run.sh. This script must be copied to the following container directory: /opt/application/run.sh.​
  • The service must start within 120 seconds. Otherwise, the following error will occur.​
  • ​
    {​
    Status: "failed"​
    StatusMessage: "Function cold start timeout, please check your log/code and then retry, or contact oncall"​
    }​
    ​
  • Container file read/write permissions​
  • If the run-as-user UID of the container is set to root, veFaaS runs your container image as root. If a specific user is specified in your Dockerfile, the container image will not run under that designated user.​
  • Container image size limit​
  • The container image must not exceed 10 GiB in size.​
Procedure​
  1. Write a Dockerfile in the current directory of your project. The following is a Dockerfile example for an HTTP service written in Go.​
​
FROM golang:latest​
​
# Copy the files from the current directory on the host machine to the /opt/application directory in the Docker container.​
COPY ./output/main /opt/application/main​
COPY run.sh /opt/application/run.sh​
​
# Set the working directory.​
WORKDIR /opt/application​
USER root​
​
# The file to be executed when Docker starts.​
CMD /opt/application/run.sh​
​
  1. Run the following command to specify the CR instance. In the command, replace IMAGE_NAME with your image name. Assume that the target veFaaS region is China (Beijing) and that your image name is xxx-cn-beijing.cr.volces.com/vefaas/native-image-go:latest.​
​
# export IMAGE_NAME=[Instance domain name]/[Namespace]/[OCI repository]:[Tag]​
export IMAGE_NAME="xxx-cn-beijing.volces.com/vefaas/native-image-go:latest"​
​
  1. Run the following command to build the image.​
​
docker build -t $IMAGE_NAME .​
​
  1. Run the following command to push the image to CR.​
​
export UserName="****" # UserName: You can obtain this from the Image Registry console.​
export PassWord="****" # PassWord: This is the image registry instance access password you set in the prerequisites.​
docker login --username=$UserName --password=$PassWord xxx-cn-beijing.volces.com​
docker push $IMAGE_NAME​
​
What to do next​
  1. Create a Web app function in the veFaaS console. When you create the function, set its deployment method to "Image". For detailed steps, see Creating functions.​
  1. Release your function image and configuration. For details, see Releasing functions.​
Last updated: 2026.08.19 14:06:05