Enonic version: 6.5.1
OS: Mac OSX
Im not very experienced with docker, but ive tried follwing the guides on documentation and dockerhub page.
Setting up a single installaton works fine, but im having trouble when launching with an external volume.
It gives me error:
14:05:39.213 INFO c.e.x.l.i.framework.FrameworkService - Starting Enonic XP... ERROR: Unable to create cache directory: /enonic-xp/home/work/osgi/cache ERROR: Error creating bundle cache. (java.lang.RuntimeException: Unable to create cache directory.) java.lang.RuntimeException: Unable to create cache directory.
Ive tried two methods.
First binding to a local folder using:
docker run -d -p 8080:8080 -v ~/xp-home/:/enonic-xp/home --name xp-app-local-vol enonic/xp-app:6.5.1
And the suggested method in documentation
docker run -d -p 8080:8080 --volumes-from xp-home --name xp-app enonic/xp-app
The last one seems to have another issue, cause the volume-container quits after showing me a MOTD-style ascii “Enonic XP -=Home Container=-”.
Enonic XP is running as a ordinary user with the uid of 1337.
try doing a
chown 1337 -R ~/xp-home/ on your mac and the enonic-xp instance should have write access to the filesystem.
The output of “Enonic XP -=Home Container=-” is from the xp-home container and is correct as it should exit.
If you wan’t you can use the docker-compose setup from https://github.com/enonic-cloud/docker-compose-enonic-xp
This is easier to start and stop than the ordinary docker commands as everything is configured in the package.
For more info on docker-compose, take a look at: https://docs.docker.com/compose/
Thanks for the reply. I got it up and running using
docker run -d -p 8080:8080 --volumes-from xp-home --name xp-app enonic/xp-app. However, it doesnt seem linked to a local folder, so im wondering how you would go about deploying applications running this setup?
Tried again by mapping to local folder and changing permissions.
It still doesn’t work. See attached screenshot.
Other screenshot (since im only allowed one per post…
Ive figured this out, the problem seems to be tied to the way docker uses the user. When doing this manually i uncovered that the /enonic/xp folder was owned by uid 1000 (which was no existing user either on docker or home).
After messing around with the docker file, i removed all references to a xp-user and ran everything on root (which i think is perfectly fine in a docker world). This way you avoid having to chown stuff on your local pc, and everything just works.
Created pull-request to github (https://github.com/enonic/docker-xp/pull/2)
I do not agree. specifying a user disables the possibility of some one/thing manipulating files it should not have access to manipulate, Remember you are still using the same kernel as the host os. And there have been bugs in the past that enables access to host os from a virtualized environmet.
Persistent data should not be stored trough a mounted volume on the host os because of file permissions issues, and also makes the config pinned to that host. this is not recommended practise with docker.
For enonic XP I recommend you only mount up the deploy folder to the local hosts filesystem in a development environment so that you do not need to rebuild the containers for each xp app redeployment. Usally you deploy with chmod 644 which makes the enonic-xp user able to read the file.