函数工作流 FUNCTIONGRAPH-使用容器镜像创建并执行事件函数:步骤二:本地验证
时间:2025-03-18 11:15:43
步骤二:本地验证
- 启动docker容器
docker run -u 1003:1003 -p 8000:8000 custom_container_event_example:latest
- 打开一个新的命令行窗口,向开放的8000端口发送消息,访问模板代码中指定的/init路径
curl -XPOST -H 'Content-Type: application/json' localhost:8000/init
按照模块代码中返回
Hello init
- 打开一个新的命令行窗口,向开放的8000端口发送消息,访问模板代码中指定的/invoke路径
curl -XPOST -H 'Content-Type: application/json' -d '{"message":"HelloWorld"}' localhost:8000/invoke
按照模块代码中返回
Hello invoke
- 在容器启动端口可以看到
Listening on http://localhost:8000 receive {} receive { message: 'HelloWorld' }
或者使用docker logs命令获取容器的日志
support.huaweicloud.com/qs-functiongraph/functiongraph_04_0104.html