0

I'm trying to run a bash script from a Docker Image on a Mac. Here is my Dockerfile

FROM bash ADD app.sh / ENTRYPOINT ["/bin/bash", "/app.sh"] 

Error

docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/bin/bash": stat /bin/bash: no such file or directory: unknown. 

This is a simple exercise in creating Docker Images where I need to execute app.sh when I run docker run.

Any idea what I'm doing wrong?

1 Answer 1

1

According to your error message, the file /bin/bash does not exist in your Docker image. Why is this?

The bash image puts the bash executable at /usr/local/bin/bash. Here's how I determined this:

$ docker run -it bash bash-5.1# which bash /usr/local/bin/bash bash-5.1# 

I ran the bash image with -it to make it interactive, then used the which command to give me the full path to bash, which is /usr/local/bin/bash.

For that reason, you need to change your Dockerfile like this:

FROM bash ADD app.sh / ENTRYPOINT ["/usr/local/bin/bash", "/app.sh"] 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.