I'm currently working on a Dockerfile that requires me to have permissions to read, write and execute on two specific folders. When it comes time to run the the chmod commands, it just fail. I can manually change the permissions once inside the docker container but it doesn't seem to pick it up from the command. This is what it looks like currently:
FROM <image-source>
SHELL ["/bin/bash", "-c"]
USER root
WORKDIR /bla/bla
COPY . .
CMD chmod 777 -R /src/main/*
CMD chmod 777 -R /app/main/*
A Dockerfile can only have one CMD instruction, which define the command occuring when the container is launched.
Try to replace these lines:
CMD chmod 777 -R /src/main/*
CMD chmod 777 -R /app/main/*
by:
RUN chmod 777 -R /src/main/*
RUN chmod 777 -R /app/main/*
In this case, chmod commands will occurs when building the image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With