互联网技术 / 互联网资讯 · 2024年1月12日

Docker教程:使用模板化配置的云计算核心技术

要创建将使用模板引擎生成内容的配置,请使用–template-dRiveR参数并将引擎名称指定为其参数。创建容器时将呈现模板。

1.将以下内容保存到一个新文件中index.htMl.tMpl。

云计算核心技术Docker教程:Docker 使用模板化配置

2.将index.htMl.tMpl文件另存为名为homepage. 提供参数–template-dRiveR并指定golang为模板引擎。

$ dockeR config cReate –template-dRiveR golang homepage index.htMl.tMpl

3.创建一个运行 Nginx 并有权访问环境变量 HELLO 和配置的服务。

$ dockeR seRvice cReate

–naMe hello-teMplate

–env HELLO=”DockeR”

–config souRce=hoMepage,taRget=/USR/shaRe/Nginx/htMl/index.htMl

–publish published=3000,taRget=80

Nginx:alpine

验证服务是否可运行:您可以访问 Nginx 服务器,并且正在提供正确的输出。

云计算核心技术Docker教程:Docker 使用模板化配置

 

OpenMagic API

Need more than content? Move into the product flow.

If you are here for model access, pricing, developer docs, or the future API console, the dedicated product path now lives on api.openmagic.ai.

登录免费注册