Kyle
Kyle

Reputation: 21

Dockerfile which won't run

I'm making a Dockerfile to implement a server appliance.

I believed my file to be complete, but on implementing it I am returned an error;

/docker-entrypoint.sh: line 22: /opt/author/application/bin/start-ppliance.sh: Permission denied
/docker-entrypoint.sh: line 22: exec: /opt/author/application/bin/start-appliance.sh: cannot execute: Permission denied

In the Dockerfile itself, I run the following;

RUN  chmod -R 0750 /opt/author/
RUN  chown -R USER1:USER1   /opt/author/

As well as;

USER USER1

In the Dockerfile itself the last line is;

CMD ["/opt/author/application/bin/start-appliance.sh", "run"]

I'm not clear why this error occurs, as the file is inside the container and is owned by the default user.

Upvotes: 2

Views: 249

Answers (1)

Dima Spivak
Dima Spivak

Reputation: 807

As you already know, this usually happens when your file doesn't have the execute bit set, though your chmod 750 should, in theory, handle this. One way to debug if that's actually the issue would simply be to pass in a different CMD at docker run time (e.g. docker run -it <image> sh) and check the script's permissions with ls -l. More often than not, not having execute bit set is the culprit.

If it's not that, I'd recommend clarifying the question with the full Dockerfile just in case something like a VOLUME directive may be discarding the effects of the RUN you're using.

Upvotes: 1

Related Questions