1

I'm modifying an existing docker image which was originally as follows:

FROM puppet/puppetserver-standalone:2.7.2

ENV PUPPETDB_TERMINUS_VERSION="4.3.0"

RUN apt-get update && \
    apt-get install --no-install-recommends -y puppetdb-termini="$PUPPETDB_TERMINUS_VERSION"-1puppetlabs1 && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN puppet config set storeconfigs_backend puppetdb --section main && \
    puppet config set storeconfigs true --section main && \
    puppet config set reports puppetdb --section main

COPY puppetdb.conf /etc/puppetlabs/puppet/

COPY Dockerfile /

There is already a command copying to /etc/puppetlabs/puppet/ I'm now an additional script to the same folder by adding a second COPY as follows:

COPY node.sh /etc/puppetlabs/puppet/

This change compiles but when I use the image in a docker-compose project everything breaks. It seems to be related to a permission issue:

puppet | Caused by: org.jruby.exceptions.RaiseException: (RuntimeError) Got 8 failure(s) while initializing: File[/opt/puppetlabs/server/data/puppetserver/state]: change from absent to directory failed: Could not set 'directory' on ensure: Permission denied - /opt/puppetlabs/server/data/puppetserver/state; File[/opt/puppetlabs/server/data/puppetserver/lib]: change from absent to directory failed: Could not set 'directory' on ensure: Permission denied - /opt/puppetlabs/server/data/puppetserver/lib; File[/opt/puppetlabs/server/data/puppetserver/preview]: change from absent to directory failed: Could not set 'directory' on ensure: Permission denied - /opt/puppetlabs/server/data/puppetserver/preview; File[/opt/puppetlabs/server/data/puppetserver/bucket]: change from absent to directory failed: Could not set 'directory' on ensure: Permission denied - /opt/puppetlabs/server/data/puppetserver/bucket; File[/opt/puppetlabs/server/data/puppetserver/yaml]: change from absent to directory failed: Could not set 'directory' on ensure: Permission denied - /opt/puppetlabs/server/data/puppetserver/yaml; File[/opt/puppetlabs/server/data/puppetserver/server_data]: change from absent to directory failed: Could not set 'directory' on ensure: Permission denied - /opt/puppetlabs/server/data/puppetserver/server_data; File[/opt/puppetlabs/server/data/puppetserver/reports]: change from absent to directory failed: Could not set 'directory' on ensure: Permission denied - /opt/puppetlabs/server/data/puppetserver/reports; File[/opt/puppetlabs/server/data/puppetserver/facts.d]: change from absent to directory failed: Could not set 'directory' on ensure: Permission denied - /opt/puppetlabs/server/data/puppetserver/facts.d

I'm really puzzled because there was already a .conf file being copied to the same folder before I added my modification. Does anyone have an idea on how this change may have affected permissions?

2

According to the page on DockerHub the image code should be identical to the github code.

I found that importing the image directly in a second docker image instead of modifying the original seemed to work:

Dockerfile:

FROM puppet/puppetserver

COPY node.sh /etc/puppetlabs/puppet/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.