要创建将使用模板引擎生成内容的配置,请使用--template-driver云计参数并将引擎名称指定为其参数。创建容器时将呈现模板。
1.将以下内容保存到一个新文件中算核index.html.tmpl。
2.将index.html.tmpl文件另存为名为h心技omepage. 提供参数--template-driver并指定golang为模板术D引擎。
$ docker config create --template-driver gocolang homepage index.html.tmpl
3.创建一个运行 Nginxke 并有权访问环境变量 HELLO 和配置的服务。
$ docker service creater教 \
--name hello-template \
 程:; --env HELLO="Docker" \
Do --config source=homepage,target=/usr/shckare/nginx/html/index.html \
--puerblish published=3000,target=80 \
&nbs 使p; nginx:alpine
验证服务是否可运行:您可以访问 Nginx 服务器,并且正用模在提供正确的输出。
电话:020-123456789
传真:020-123456789
Copyright © 2026 Powered by 万家灯火网 https://tmpi-quickclean.com/