# 拉取 SCF 源镜像docker pull ccr.ccs.tencentyun.com/scf-repo/scf-runtimes-image:latest
sudo
再执行。/scf/lang/
目录下查看当前镜像所包含的 Runtime。
由于云函数源镜像包括所有的 Runtime,单个容器镜像较大。请参考以下表格内容,根据需求自行选择 Runtime 镜像。Runtime | 地址 |
SCF | ccr.ccs.tencentyun.com/scf-repo/scf-runtimes-image:latest |
Go 1.8 | ccr.ccs.tencentyun.com/scf-repo/runtime-go1:latest |
Python 2.7 | ccr.ccs.tencentyun.com/scf-repo/runtime-python2:latest |
Python 3.6 | ccr.ccs.tencentyun.com/scf-repo/runtime-python3:latest |
PHP 5.6 | ccr.ccs.tencentyun.com/scf-repo/runtime-php5:latest |
PHP 7.2 | ccr.ccs.tencentyun.com/scf-repo/runtime-php7:latest |
Java 8 | ccr.ccs.tencentyun.com/scf-repo/runtime-java8:latest |
Node 6.10 | ccr.ccs.tencentyun.com/scf-repo/runtime-node6:latest |
Node 8.9 | ccr.ccs.tencentyun.com/scf-repo/runtime-node8:latest |
Node 10.15 | ccr.ccs.tencentyun.com/scf-repo/runtime-node10:latest |
Node 12.16 | ccr.ccs.tencentyun.com/scf-repo/runtime-node12:latest |
scf:python3
标签为例,执行以下命令为镜像重新贴上标签。示例如下:docker pull ccr.ccs.tencentyun.com/scf-repo/runtime-python3:latest# 通过该指令找到 IMAGE ID 并复制docker images# docker tag IMAGE_ID REPOSITORY:TAGdocker tag 0729ecc15d37 scf:python3
scf:python3
替换为 ccr.ccs.tencentyun.com/scf-repo/runtime-python3:latest
。docker pull ccr.ccs.tencentyun.com/scf-repo/runtime-node12:latest# 通过该指令找到 IMAGE ID 并复制docker imagesdocker tag d64a665357b6 scf:node12
/path/to/your_project
目录挂载至容器中的 /tmp/your_project
目录为例。示例如下:docker run -it -v /path/to/your_project:/tmp/your_project scf:node12 /bin/bash
cd
命令进入容器内目录,在该目录执行 npm
命令安装 NodeJieba。示例如下:cd /tmp/your_projectnpm install nodejieba --save
/path/to/your_project
目录下。执行 exit
命令可退出容器。示例如下:# 退出容器exit
docker pull ccr.ccs.tencentyun.com/scf-repo/runtime-python3:latest# 通过该指令找到 IMAGE ID 并复制docker imagesdocker tag d64a665357b6 scf:python3
docker run --name test -it -v /path/to/your_project:/tmp/your_project scf:python3 /bin/bash
docker exec
命令进入容器进行开发。示例如下:docker ps# 获得CONTAINER IDdocker exec -it CONTAINER_ID /bin/bash
# 获得容器的 IDdocker ps# 保存镜像至本地# docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]docker commit db47b8e66e64 scf:myimage
本页内容是否解决了您的问题?