在docker.yml文件中替换env varaible
我在Docker容器中使用Kong db-db-necorrative模式:
Dockerfile
FROM kong
USER 0
RUN mkdir -p /kong/declarative/
COPY declarative/kong.yml /kong/declarative/
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN ["chmod", "+x", "/docker-entrypoint.sh"]
RUN cp /etc/kong/kong.conf.default /etc/kong/kong.conf
RUN apk add gettext
和Docker-Compose环境变量,我
在Docker-entrypoint.sh中
#!/usr/bin/env bash
envsubst < /kong/declarative/kong-template.yml > /kong/declarative/kong.yml
添加了myName = amin
,我使用了 :但是, kong-template.yml中的Env变量,
例如
routes:
- name: gamma
methods:
- GET
paths:
- /$MYNAME/gamma
strip_path: true
,Kong容器停止以退出误差。
有人知道有什么问题吗?
attaching to kong
kong existed with code 0
I am using kong db-less declarative mode in a docker container as below:
Dockerfile
FROM kong
USER 0
RUN mkdir -p /kong/declarative/
COPY declarative/kong.yml /kong/declarative/
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN ["chmod", "+x", "/docker-entrypoint.sh"]
RUN cp /etc/kong/kong.conf.default /etc/kong/kong.conf
RUN apk add gettext
and in the docker-compose environment variable, I add MYNAME=amin
In docker-entrypoint.sh I have:
#!/usr/bin/env bash
envsubst < /kong/declarative/kong-template.yml > /kong/declarative/kong.yml
And I use the env variable in kong-template.yml
for example
routes:
- name: gamma
methods:
- GET
paths:
- /$MYNAME/gamma
strip_path: true
However, the kong container stops with an exit error.
Does anybody know what is the problem?
attaching to kong
kong existed with code 0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论