tencent cloud

Serverless Cloud Function

Release Notes and Announcements
Release Notes
Announcements
User Guide
Product Introduction
Overview
Related Concepts
How It Works
Strengths
Scenarios
Related Products
Purchase Guide
Billing Overview
Billing Mode
Billable Items and Billing Modes
Function Computing Power Support
Free Tier
SCF Pricing
Billing Example
Payment Overdue
Getting Started
Creating Event Function in Console
User Guide
Quota Management
Managing Functions
Web Function Management
Log Management
Concurrence Management
Trigger Management
Function URL
A Custom Domain Name
Version Management
Alias Management
Permission Management
Running Instance Management
Plugin Management
Managing Monitors and Alarms
Network Configuration
Layer Management
Execution Configuration
Extended Storage Management
DNS Caching Configuration
Resource Managed Mode Management
Near-Offline Resource Hosting Model
Workflow
Triggers
Trigger Overview
Trigger Event Message Structure Summary
API Gateway Trigger
COS Trigger
CLS Trigger
Timer Trigger
CKafka Trigger
Apache Kafka Trigger
MQTT Trigger
Trigger Configuration Description
MPS Trigger
CLB Trigger Description
TencentCloud API Trigger
Development Guide
Basic Concepts
Testing a Function
Environment Variables
Dependency Installation
Using Container Image
Error Types and Retry Policies
Dead Letter Queue
Connecting SCF to Database
Automated Deployment
Cloud Function Status Code
Common Errors and Solutions
Developer Tools
Serverless Web IDE
Calling SDK Across Functions
Third-Party Tools
Code Development
Python
Node.js
Golang
PHP
Java
Custom Runtime
Deploying Image as Function
Web Framework Development
Deploying Framework on Command Line
Quickly Deploying Egg Framework
Quickly Deploying Express Framework
Quickly Deploying Flask Framework
Quickly Deploying Koa Framework
Quickly Deploying Laravel Framework
Quickly Deploying Nest.js Framework
Quickly Deploying Next.js Framework
Quickly Deploying Nuxt.js Framework
Quickly Deploying Django Framework
Use Cases
Overview
Solutions with Tencent Cloud Services
Business Development
TRTC Practices
COS Practices
CKafka Practice
CLS
CLB Practice
MPS
CDN
CDWPG
VOD
SMS
ES
Scheduled Task
Video Processing
Success Stories
Tencent Online Education
Online Video Industry
Tencent Online Education
Best Practice of Tencent IEG Going Global
API Documentation
History
Introduction
API Category
Making API Requests
Other APIs
Namespace APIs
Layer Management APIs
Async Event Management APIs
Trigger APIs
Function APIs
Function and Layer Status Description
Data Types
Error Codes
SDK Documentation
FAQs
General
Web Function
Billing FAQs
Network FAQs
Log FAQs
SCF utility class
Event Handling FAQs
API Gateway Trigger FAQs
Related Agreement
Service Level Agreement
Contact Us
Glossary

Usage Method

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2024-12-02 18:12:22
This document describes how to use image to deploy function via the console.

Prerequisites

SCF supports the image repositories of TCR Enterprise Edition and Personal Edition. You can select the image repository as needed.
Purchase a TCR Enterprise Edition instance. For more information, see Quick Start.
Use a TCR Personal Edition image repository. For more information, see Getting Started.

Creating functions via the console

Image pushing

Run the following code to push the built image to your image repository.
# Switch to the file download directory
cd /opt

# Download Demo
git clone https://github.com/awesome-scf/scf-custom-container-code-snippet.git

# Log in to the image repository. Replace $YOUR_REGISTRY_URL with your image repository, and replace $USERNAME and $PASSWORD with your login credentials respectively.
docker login $YOUR_REGISTRY_URL --username $USERNAME --password $PASSWORD

# Build images. Replace $YOUR_IMAGE_NAME with your image address.
docker build -t $YOUR_IMAGE_NAME .

# Push images
docker push $YOUR_IMAGE_NAME

Creating a function

1. Log in to the SCF console and click Function Service in the left sidebar.
2. At the top of the page, select the region and the namespace where to create a function, and click Create to enter the function creation process.
3. Select Use TCR image and specify the basic function information.
Parameter
Operation
Function type
Select Event-triggered function or HTTP-triggered Function.
Function name
Define the function name.
Region
Select the region where to deploy the function. The function must be in the same region as the image repository.
time zone
SCF uses the UTC time by default, which you can modify by configuring the TZ environment variable. After you select a time zone, the TZ environment variable corresponding to the time zone will be added automatically.
Images
Select the Personal Edition or Enterprise Edition image repository you created.
Image tag
Select the image tag. If this parameter is left empty, the latest version of the image will be used by default.
Entrypoint
Enter the bootstrap command of the container. Parameter input specification: enter an executable command, such as a python command. This parameter is optional. If it is left empty, the Entrypoint value in the Dockerfile will be used by default.
CMD
Enter the bootstrap parameter of the container. Parameter input specification: use "space" as the parameter separator, for example, -u app.py. This parameter is optional. If it is left empty, the CMD value in the Dockerfile will be used by default.
Image acceleration
Enable image acceleration as needed. After image acceleration is enabled, SCF can pull images more efficiently. It takes over 30 seconds to enable image acceleration, so please be patient.
4. Click Complete.

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백