Can someone help me with Docker? I can't figure ou...
# lucee
r
Can someone help me with Docker? I can't figure out how to copy my .CFConfig.json and .jar files over to the the container I'm building using the official Lucee Docker image (lucee/lucee:6.2.1.122-nginx)
b
Hey redtopia, Here is a very basic Dockerfile that might help explain how to transfer a .CFConfig.json file... FROM lucee/lucee:6.2.1.122 COPY lucee-config.json /opt/lucee/server/lucee-server/context/.CFConfig.json COPY www/ /var/www/ In the above case I have a lucee-config.json file in the same directory as the Dockerfile JAR files would be handled similarly to their appropriate directories. Hope that helps.
r
Thanks Bill... is this working for you? It's not working for me.
b
Detail on what is not working?
r
from what I can tell, when Lucee starts up, it nukes the config file because at the time when the file is copied, that location doesn't exist. Then, when Lucee starts for the first time, that context is created and the file that was copied is gone
b
I took a peak at your post on Lucee. You are using an Nginx image. My experience is it works well, but I also include an Nginx default.conf file too.
r
Thanks... I've got nginx working. The issue I'm trying to figure out is that when Lucee runs, it's not using my .CFConfig.json
b
As a help, your config file should not have a period in front of it. Name the file something like lucee-config.json
Instead of .CFConfig.json
COPY lucee-config.json /opt/lucee/server/lucee-server/context/.CFConfig.json
r
that's not my understanding, but I could be wrong. I've been able to deploy .CFConfig.json files in other scenarios. Typically, you would drop it into the /deploy folder, which I can do if I mount the volume rather than copy it.
but... I'll give that a try
b
Yep, give it a go
r
thanks
however, your example is copying your config file to a .CFConfig.json file
the source filename is irrelevant because when it's being copied to /opt/lucee/server/lucee-server/context/ it becomes .CFConfig.json
b
It does not change the name, just the content
r
Doesnt this command:
Copy code
COPY lucee-config.json /opt/lucee/server/lucee-server/context/.CFConfig.json
copy lucee-cfconfig.json to .CFConfig.json What am I missing?
b
Yes, it copies the content of lucee-config.json to .CFConfig.json
r
and why would changing the source name have any effect on the command?
b
Did you try it?
r
no, but I don't understand what you're saying here... are you saying that outcome is different if the source filename is different?
b
As a help, it is possible to have a blank config.json file such as {}. With Lucee, it looks at the file and only uses anything that is modified.
When you copy a config.json to .CFConfg.json, Lucee handles it from there
I just read your conversation with Zackster. I did not know that JARs don't work using the deploy folder.
All I can tell you is to follow the Dockefile example I gave you. From my experience it works well.
d
fwiw, we are using the same Lucee Docker image and it is working for us to copy to the context directory.
Copy code
COPY .CFConfig.json /opt/lucee/server/lucee-server/context/.CFConfig.json
r
I can confirm that there is no functional difference by naming the source file differently
b
I think we are just trying to get it to work for you.
r
@danmurphy are you doing anything other than copying it?
My Dockerfile looks like this:
Copy code
FROM lucee/lucee:6.2.1.122-nginx

COPY ./.CFConfig.json /opt/lucee/server/lucee-server/context/.CFConfig.json
d
Really the only thing we do first is load some other config files…
Copy code
# Copy default nginx config files
COPY nginx.conf /etc/nginx/
COPY default.conf /etc/nginx/conf.d/

# Copy supervisord.conf
COPY supervisord.conf /etc/supervisor/conf.d/
Stupid question maybe, but your
.CFConfig.json
file is in the right place relative to your Dockerfile for that copy command to work?
r
but when I run the container, and look at
opt/lucee/server/lucee-server/context/.CFConfig.json
it is not the file I copied and has none of the settings in it
b
Okay, one last try... To help narrow it down, put the config file in the same directory as the Dockerfile. If you have problem changing the name, no worries, as Dan has shown
r
Docker fails to build my image if my config file is not found... the COPY command seems to be working
d
Ah, right, that makes sense.
r
the crazy thing is that if I mount my config file, it does work, but if I copy it, it doesn't
d
What if you try to set a WORKDIR before the COPY. I don’t think that should be necessary, but we are doing it right after the FROM line, it looks like (for some apt-get stuff, it seems). So we set ours to
WORKDIR /tmp/work
.
Just trying to think of differences between ours and yours.
r
are you creating that dir first?
d
No, so it must already exist from the default image.
r
that doesn't work
d
How are you building and running the container? Anything abnormal or just simple
docker run
stuff?
r
I'm basically doing a: docker-compose -f docker-compose.yml up -d But I assume I'll be doing a docker run if that's all I need to do... I'm still in the process of just building the image and running it after the build
d
Hmm. I’ve somehow managed to never use Docker Compose, so this is quickly getting over my head there.
r
how do you build your container?
d
Locally? Running Rancher Desktop with
docker build
and
docker run
commands.
r
I see... I'm running vscode and docker desktop on win11
d
Yeah, all the nice Docker stuff in VS Code works just the same with Rancher Desktop. It’s just free (and probably more of a pain than Docker Desktop). We used to use Docker Desktop until they changed their licensing a few years back.
b
It might be me, but I never use Compose, I prefer single use containers.
That said, the Lucee team has already created a really nice image that contains Nginix
d
Yeah, it looks like he is using that one.
r
I've got several different types of containers in the same composition group, so it seems like the way to go. I have a script that builds all of them, or any one of them. So if I need to build my entire app infra, I can run
./build.sh all
👍 1
d
Ok, one difference - we are using the light version which has no extensions installed by default. I just noticed that. So we’re using
lucee:6.2.1.122-light-nginx
. I don’t know why that would matter, but that’s another difference.
b
docker image build -t myusername/lucee:xyz .
Yeah the light version is great too. A lot quicker to deploy
z
@redtopia you are still using a custom container right? Probably worth mentioning. 6.2.1 logs all processing of files in the deploy folder, including rejection of unsupported types to
deploy.log
The unsupported files are moved to the
failed_to_deploy
folder under deploy Lucee 6.2.1 has good logging for all this, look at the logs!!!
r
@zackster I am using the official Lucee build:
lucee/lucee:6.2.1.122-nginx
Everything works when I mount my config file in
docker-compose.yml
Copy code
volumes:
      - ./.CFConfig.json:/opt/lucee/server/lucee-server/context/.CFConfig.json
But when I try to copy it, it doesn't stick. I tried both of these commands and they don't work:
Copy code
COPY ./.CFConfig.json /opt/lucee/server/lucee-server/deploy/.CFConfig.json
COPY ./.CFConfig.json /opt/lucee/server/lucee-server/context/.CFConfig.json
z
Can we stick to the mailing list for this discussion
👍 1