File write permissions on lucee docker image

All of your diagnostics that you’ve posted are from the PoV of your host, not your container. You need to diagnose the status within the built container, not your host.

cd ~/lucee
docker build -t testimage .
docker run -d --name testimage testimage

Now lucee is running with your built image.

docker exec -it testimage bash
ls -ld /
ls -ld /var
ls -ld /var/www
ls -l /var/www

Verify all that works

Determine the processes running.

apt-get update
apt-get install procps
ps awwux

Following these steps it looks to me like most things are good based on what you’ve provided, you SHOULD be able to write to that file… so here’s the next question… Did you try to append or write to /var/www/textfile.json?

I don’t mean expandpath, I mean the ACTUAL ABSOLUTE path.

Or did you try to cfoutput the expandpath results and verify you’re actually getting the file path you think…

When I copy your example code into application.cfc and run it, it works. And by it works, I mean:

docker exec -it testimage cat /var/www/textfile.json

Returns the proper result.

If you’re expecting ~userme/lucee/www to change on the host, you don’t want to create a build, you want a volume mount.

Cleanups

docker stop testimage
docker rm testimage

Interactive dev environment

docker run -d --rm -p 8888:8888 --name testimage -v /home/userme/lucee/www:/var/www lucee/lucee4 
docker logs testimage

Or run without the name, swap -d for -it, and just ctrl-c when done. No build necessary.

So based on what you’re reporting, my guess is it IS writing to the file, in /var/www, in the container, which is a COPY of your files. But that’s not where you’re looking. :slight_smile:

1 Like