# Docker container could not execute an executable binary

**URL:** <https://forums.docker.com/t/docker-container-could-not-execute-an-executable-binary/117232>\
**Category:** General\
**Tags:** docker\
**Created:** [November 5, 2021, 1:41pm UTC](https://forums.docker.com/t/docker-container-could-not-execute-an-executable-binary/117232 "2021-11-05T13:41:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephen1h](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@stephen1h](https://forums.docker.com/u/stephen1h)\
**Post date:** [November 5, 2021, 1:41pm UTC](https://forums.docker.com/t/docker-container-could-not-execute-an-executable-binary/117232/1 "2021-11-05T13:41:30Z")

</div>

Hello team, I have the following in my Dockerfile

```auto
WORKDIR /test
RUN curl <link for some executable binary> --output <executable_binary_name>
COPY <config for binary> .
RUN chmod +x <executable_binary_name>
CMD ["./<executable_binary_name>", "--config", "<executable_config_file_name>"]

```

But the Docker container won’t run because `could not execute ./<executable_binary_name>: fork/exec ./<executable_binary_name>: no such file or directory` . I tried it with `CMD ["/test/<executable_binary_name>", "--config", "/test/<executable_config_file_name>"]` but it still couldn’t execute. I ran those commands individually on my terminal and they all work fine. I’m able to download the binary, I’m able to make it an executable, and I’m able to run the executable. But I’m not sure why they won’t work in a Docker container. Can someone please help me with this issue?

---

<div class="post-metadata">

**Author:** ![meyay](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/meyay/32/34000_2.png) [@meyay](https://forums.docker.com/u/meyay)\
**Post date:** [November 5, 2021, 3:46pm UTC](https://forums.docker.com/t/docker-container-could-not-execute-an-executable-binary/117232/2 "2021-11-05T15:46:36Z")

</div>

You might want to test if the curl command actualy downloaded the binary. Create your container with `docker run -ti --rm --entrypoint /bin/sh <yourimagename>`, then execute `ls -l /test’ and check if the filesize matches your expectation… if the size matches, try to execute it, if it’s too small, try to cat it.

---

<div class="post-metadata">

**Author:** ![stephen1h](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@stephen1h](https://forums.docker.com/u/stephen1h)\
**Post date:** [November 5, 2021, 3:54pm UTC](https://forums.docker.com/t/docker-container-could-not-execute-an-executable-binary/117232/3 "2021-11-05T15:54:55Z")

</div>

I created the container with your command and ran ‘ls -l /test’. I am able to see the binary and the config file with their appropriate file sizes. However, when I try to execute the binary, it says /bin/sh: ./\<executable\_binary\_name\>: not found. I don’t understand. The file is right there and it is executable.

---

<div class="post-metadata">

**Author:** ![stephen1h](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@stephen1h](https://forums.docker.com/u/stephen1h)\
**Post date:** [November 5, 2021, 4:23pm UTC](https://forums.docker.com/t/docker-container-could-not-execute-an-executable-binary/117232/4 "2021-11-05T16:23:34Z")

</div>

I was able to resolve the issue. Thank you.

---

<div class="post-metadata">

**Author:** ![meyay](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/meyay/32/34000_2.png) [@meyay](https://forums.docker.com/u/meyay)\
**Post date:** [November 5, 2021, 4:47pm UTC](https://forums.docker.com/t/docker-container-could-not-execute-an-executable-binary/117232/5 "2021-11-05T16:47:33Z")

</div>

Please share your solution, as it might be usefull for someone stumbling accross this thread.

---

<div class="post-metadata">

**Author:** ![stephen1h](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@stephen1h](https://forums.docker.com/u/stephen1h)\
**Post date:** [November 5, 2021, 5:17pm UTC](https://forums.docker.com/t/docker-container-could-not-execute-an-executable-binary/117232/6 "2021-11-05T17:17:24Z")

</div>

The issue was that I was using an incorrect docker component from my company’s repository. The above Dockerfile should work in general cases.
