自定义lucee5 docker映像以允许在映像中运行多个网站 [英] customize lucee5 docker image to allow running of multiple website within the image

查看:125
本文介绍了自定义lucee5 docker映像以允许在映像中运行多个网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用docker-compose运行lucee5映像,并且效果很好.我能够将本地卷链接到dockerimages中. 本地项目包含4个网站,这些网站都应在docker映像中运行. 我希望能够连接到它们,例如localhost:1337/customer和localhost:1337/player和localhost:1337/etc ..

I am running the lucee5 image with docker-compose and that works well. I was able to link my local volume into the dockerimages. the local project contains 4 websites which should all run within the docker image. I would like to be able to connect to them like localhost:1337/customer and localhost:1337/player and localhost:1337/etc..

为此,我必须在docker image上安装Apache,我知道该怎么做.但是,当我退出时停止docker-compose并尝试使用新更改持久保存最后一个容器时,当我想使用compose(退出代码0)运行该新容器时,遇到了错误消息.

So for this I have to setup Apache on the docker image which I know how to do. However, when I quit stop docker-compose and try to persist the last container with the new changes, I run into a error message when I want to run that new container using compose (exit code 0).

我的最终目标是能够启动docker-compose,以便我可以使用3个网站进行测试,并且在docker运行相同源代码的同时,我可以在自己的IDE中本地处理项目. 我知道我也可以将我的MYSQL数据库也放置在docker-image之外,并对其进行引用.

My end goals is to be able to start up docker-compose so that I have my 3 websites available for testing and I can work on the project locally in my IDE whilst docker is running that same source. I know I could put my MYSQL database also outside of the docker-image and reference it.

更改图片时如何解决该错误退出0?

How do I tackle that error exit 0 when changing my image?

我的Docker Compose文件

My Docker Compose file

version: '2'

services:
  web:
  image: lucee/lucee5
  ports:
  - "1337:8888"
volumes:
  - /Users/matti/www/projectx/:/var/www/

projectx具有3个子文件夹,这些子文件夹具有3个运行index.cfm的cfml根目录:

projectx has 3 subfolders which have 3 cfml roots that run the index.cfm:

projectx/customer/root -> index.cfm
projectx/play/root -> index.cfm
projectx/tracker/root -> index.cfm

我会在lucee5图片的apache中创建3个apache网站.

I would make 3 apache websites in apache on the lucee5 image.

推荐答案

使用Lucee docker映像运行3个应用程序的最简单方法是为docker撰写文件中的每个文件定义服务,例如

The easiest method to run 3 apps using the Lucee docker image would be to define a service for each in your docker compose file, e.g.

version: '2'

services:
  customer-app:
    image: lucee/lucee5
    ports:
      - "8001:8888"
    volumes:
      - /your/path/to/projectx/customer/root:/var/www
      # the line below is an example of how to customise the lucee-web.xml.cfm for this app
      - /your/path/to/projectx/customer/lucee/lucee-web.xml.cfm:/opt/lucee/web/lucee-web.xml.cfm
  play-app:
    image: lucee/lucee5
    ports:
      - "8002:8888"
    volumes:
      - /your/path/to/projectx/play/root:/var/www
  tracker-app:
    image: lucee/lucee5
    ports:
      - "8003:8888"
    volumes:
      - /your/path/to/projectx/tracker/root:/var/www

如果您需要通过单个主机名但使用不同的URL路径(即mydomain.local/customer,mydomain.local/play,mydomain.local/tracker)访问每个应用程序,则可以添加一个充当以下操作的Apache容器每个3个Lucee容器的反向代理.

If you need to access each app via a single hostname but different URL paths (i.e. mydomain.local/customer, mydomain.local/play, mydomain.local/tracker), then you could add a single Apache container which acts as a reverse proxy to each of the 3 Lucee containers.

您的docker compose文件的附加服务如下所示:

The additional service for your docker compose file will look something like this;

  apache:
    image: httpd
    ports:
      - "80:80"
    volumes:
      - /your/path/to/projectx/apache/httpd.conf:/usr/local/apache2/conf/httpd.conf

您的Apache配置可以进入httpd.conf,它通过卷添加到服务中.

Your Apache configuration can go into a httpd.conf which is added to the service via a volume.

这篇关于自定义lucee5 docker映像以允许在映像中运行多个网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆