Nginx厨师Docker

发布于 2025-01-26 16:42:25 字数 652 浏览 3 评论 0原文

我是Docker概念的新手。对于应用程序,我需要创建NGINX容器。 nginx配置在厨师食谱中,因此我有示例。我不确定如何容器。我将.conf.erb复制到/etc/nginx/conf.d/example.conf.erb。我不确定该怎么办。我很困惑,没有资源在线需要立即帮助 Default.rb:

   include_recipe 'nginx_ldap_auth'
   include_recipe 'nginx'
   template 'nginx config' do
   source 'example.conf.erb'
   path '/etc/nginx/conf.d/example.conf.erb'

   owner 'root'
   group 'root'
   mode ''
   variables({'environment variables'})
   notifies :restart, 'service[nginx])'

我的Dockerfile当前看起来像这样:

FROM nginx:alpine

COPY default.conf /etc/nginx/example.conf.erb/

我不确定是否需要Docker-Compose。除了Dockerfile之外,我还没有创建太多。请指导

I am new to docker concept. For an application I need to create nginx container.
The nginx configuration is in chef cookbook, hence I have example.conf.erb file and default.rb (containing setup nginx file) in my chef/cookbook/ directory . I am not sure how to containerise. I copied .conf.erb to /etc/nginx/conf.d/example.conf.erb. I am not sure what else to do. I am confused and no resource online need help immediate
default.rb :

   include_recipe 'nginx_ldap_auth'
   include_recipe 'nginx'
   template 'nginx config' do
   source 'example.conf.erb'
   path '/etc/nginx/conf.d/example.conf.erb'

   owner 'root'
   group 'root'
   mode ''
   variables({'environment variables'})
   notifies :restart, 'service[nginx])'

My Dockerfile currently look like this:

FROM nginx:alpine

COPY default.conf /etc/nginx/example.conf.erb/

I am not sure if I need docker-compose. Apart from Dockerfile there is nothing much I have created. Please guide

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天邊彩虹 2025-02-02 16:42:25

首先让厨师创建配置文件,然后运行运行Docker构建以创建图像。

或者,您可以查看多阶段Dockerfiles

使用多个阶段,您可以首先使用包含厨师的图像,在那里创建配置文件,然后将其复制到Nginx图像中。

Either first let Chef create the config file and then run run docker build to create an image.

Or you can check out a multi stage dockerfiles.

With multiple stages you can first use an image that includes Chef, there create the config file and then copy it into the nginx image.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文