Woodsman
Woodsman

Reputation: 1179

Dockerfile permissions not taking effect

My goal is to have /ssc/bin/put-and-submit.sh to be executable. I looked at another question, but do not think it applies.

FROM perl:5.20

ENV PERL_MM_USE_DEFAULT 1
RUN cpan install Net::SSL inc:latest
RUN mkdir /ssc
COPY /ssc /ssc
RUN chmod a+rx /ssc/bin/*.sh
ENTRYPOINT ["/ssc/bin/put-and-submit.sh"]
 stat /ssc/bin/put-and-submit.sh
  File: '/ssc/bin/put-and-submit.sh'
  Size: 1892            Blocks: 8          IO Block: 4096   regular file
Device: 7ah/122d        Inode: 293302      Links: 1
Access: (0600/-rw-------)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2021-01-27 04:14:43.000000000 +0000
Modify: 2021-01-27 04:14:43.000000000 +0000
Change: 2021-01-27 04:52:44.700000000 +0000
 Birth: -

I read the question below, and believe that circumstance is when another layer is added, it overwrites the previous one. In my case, I start with a Perl image, add a few CPAN libraries, copy a few files and then ask it to change permissions.

Dockerfile "RUN chmod" not taking effect

Upvotes: 0

Views: 155

Answers (1)

Ray
Ray

Reputation: 186

I remember I had this problem too and it basically only worked when I just replaced the default /usr/local/bin/docker-php-entrypoint WITHOUT firing the ENTRYPOINT command (to use a custom entrypoint script). So in your case you have to find out what the default entrypoint file is perl is using (must also be in /usr/local/bin) and maybe replace that. Sorry it's not the exact "right" solution but in my case it worked out fine and good enough.

So what I'm doing for example for my PHP-FPM containers is the following (note that ENTRYPOINT is commented out):

COPY docker-entrypoint.sh /usr/local/bin/docker-php-entrypoint
RUN chmod +x /usr/local/bin/docker-php-entrypoint
# ENTRYPOINT ["/usr/local/bin/docker-php-entrypoint"]

Just in case, my sh script looks like this (only starts supervisor):

#!/bin/sh
set -e

echo "Starting supervisor service"
exec supervisord -c /etc/supervisor/supervisord.conf

I hope this gets you somewhere mate, cheers

Upvotes: 1

Related Questions