Leon
Leon

Reputation: 331

when I execute a shell script in docker container, the error is "No such file or directory"

My Dockerfile:

FROM centos:7.2
COPY gateway-deploy-1.1-SNAPSHOT /home/admin/gateway/
COPY entrypoint.sh /home/admin/entrypoint.sh
RUN chmod +x /home/admin/entrypoint.sh
EXPOSE 12366
VOLUME ["/home/admin/logs"]
ENTRYPOINT ["sh", "/home/admin/entrypoint.sh"]

When I start the container, entrypoint.sh should be executed, but the system prompts "No such file or directory". I tried to change the startup command to "/bin/bash" and then went to the container to see that the file exists.

Why is this problem? I have tried to make images many times, but this problem has always existed.

Upvotes: 2

Views: 2610

Answers (1)

Leon
Leon

Reputation: 331

Since I mounted an empty directory from the host to the path /home/admin when I started the container, the file was overwritten. So this is not a problem, but my mistake.

Upvotes: 1

Related Questions