问题
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..
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).
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.
How do I tackle that error exit 0 when changing my image?
My Docker Compose file
version: '2'
services:
web:
image: lucee/lucee5
ports:
- "1337:8888"
volumes:
- /Users/matti/www/projectx/:/var/www/
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
I would make 3 apache websites in apache on the lucee5 image.
回答1:
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
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.
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
Your Apache configuration can go into a httpd.conf
which is added to the service via a volume.
来源:https://stackoverflow.com/questions/41646946/customize-lucee5-docker-image-to-allow-running-of-multiple-website-within-the-im