Customize docker image



  • With jsreport-3.13.0, it was possible to make changes to the docker image as root and install/update additional package with the apk command.

    Jsreport 4 seems to limit that possibility. It still appears to be possible to make some customization as described here.

    But what if I want to do the following? How would I do that?

    RUN apk add 'libhwy<=1.0.6' \
        && apk update \
        && apk upgrade \
        && npm cache clean -f \
        && npm install -g n \
        && npm update -y
    

  • administrators

    @v3gard yes, this is expected. before v4 the default user in the image was root, so installing os packages like this worked by default.

    since v4 we introduced a fix that makes the default user, the jsreport user, this means that if you want to install os packages or any commands that require admin privileges then you need to switch the user.

    in your case, i think this should work

    FROM jsreport/jsreport:4.1.0
    USER root
    RUN apk add 'libhwy<=1.0.6' \
        && apk update \
        && apk upgrade \
        && npm cache clean -f \
        && npm install -g n \
        && npm update -y
    USER jsreport:jsreport
    

    of course, your final image may require other steps, but this is the main idea, if you need to run any command that requires admin priveleges (like running apk add) you need do it with root, and switch back to the normal jsreport user for the actions that does not require it.

    i will update the docker docs to mention these details about the user.



  • Thanks! That worked like a charm.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.