Docker-compose, local volume not mounted
-
I'm having a major problem. I don't know if it happened after upgrading from 2.6.1 to 2.7.1.
Building my jsreport image works great when I want to push a new image to Amazon. Templates and other files are correctly copied from the local volume to the image. This is the Dockerfile:
FROM jsreport/jsreport:2.7.1 COPY --chown=jsreport:jsreport license-key.txt /app COPY --chown=jsreport:jsreport ./mounted/jsreport.config.json /app COPY --chown=jsreport:jsreport ./mounted/data /app/data ENV templatingEngines:strategy in-process ENV node --max-old-space-size=3072 RUN cd /app && npm install \ moment \ moment-timezone \ intl \ handlebars-helpers \ node-fetch \ jsreport-assets \ jsreport-static-pdf \ i18next
The problem is that when I run the container locally via docker-compose the local volume is not mounted. I don't know why and I don't get any error messages. If I alter a template via Studio in the container running via docker-compose, nothing happens in the local volume.
My locally mounted disk is (or should be) the single source of truth. This volume is version controlled via gitHub. As of now my only way to save my work is to export everything from Studio to a zip file.
Here is the docker-compose file (jsreport section):
jsreport: build: context: ../services/jsreport environment: - mode=development expose: - '5488' ports: - '5488:5488' volumes: - '../services/jsreport/mounted:/jsreport'
-
I think this might be a case of me lacking Docker knowledge. It has nothing to do with jsreport 2.7. I instinctly thought 2.7 could be the villain since the new non-root behaviour of 2.7 bit me in the COPY statements (I got the solution --chown=jsreport:jsreport from Jan).
If I remove the three COPY statements from my Dockerfile the local volume gets mounted via docker-compose. I'm guessing that the COPY statements in the
Dockerfile
overrides the volume statement indocker-compose.yml
in order to avoid a circular reference.Does anyone know if I can omit those three statements automatically when I'm running the container via docker-compose? Can this kind of conditional use case be solved with context in Dockerfile?
Am I the only one who run a local container via docker-compose and also need to build a complete image for deploying to container service?
-
I'm lost again.. I thought I was on to something, but I now realise that I have te exact same setup for my API servers, and it works great.
I.e.
for development: mount local volume with source code (via docker-compose)
for deployment: copy source code from local folder to a folder within the image (via Dockerfile)Why doesn't the exact same concept work for jsreport? Does the jsreport Docker image have some magic inside which prevents my concept to work?