cannot find .sh script from the docker container

docker no such file or directory but file exists
docker bin/sh' not found
docker shell script no such file or directory
bin/sh: 0 can t open
docker no such file or directory bash script
docker run no such file or directory
docker entrypoint script no such file or directory
docker bin/sh: no such file or directory

I have Dockerfile that looks like this

FROM alpine:3.7

WORKDIR /home/tmp

RUN apk add autoconf && apk add py-pip && apk add python3 &&\
    pip install --upgrade pip && pip install wheel

Originally I wanted to execute a .sh script on startup (via ENTRYPOINT) and immediately destroy the container. However as it failed to find the file I decided to do that manually.

I run container like this

docker run -it --rm -v c:/projects/mega-nz-sdk:/home/tmp mega_sdk_python

And it connects me to bash in the container. In the list of files I can see the script I want to execute

/home/tmp # ls
Dockerfile   sdk-develop
/home/tmp #

However when I try to run it it cannot find the script

/home/tmp # ./
/bin/sh: ./ not found
/home/tmp #

What is the problem?

Script looks like this


cd sdk-develop
./configure --disable-silent-rules --enable-python --disable-examples &&\

cd /bindings/python

python bdist_wheel

Ideally I would like to execute during instantiation of the container in order to have already configured container on startup (without need to run script each I run the container).

Alpine Linux is a very minimal distribution; it includes a minimal version of most Unix tools that conform to the POSIX specification, but no more. In particular it does not include GNU Bash.

Your script doesn't actually use any special Bash features, so it would be enough to change the first line of the script to run the default system Bourne shell


Using the Alpine apk package manager to install bash would work too, but it's not necessary for what you're showing here.

Usually you'd run the sorts of "compile" commands you show during the course of building an image, not when the image starts up. I'd expect a much more typical Dockerfile to COPY the application source code and in then RUN the commands you show. That would happen just once, when you docker build the image, and not every time you want to run the packaged application.

Can't run script file in docker, no such file or directory, It is probably the Windows-style line endings that break it. Here's what the file looks like when saved with Windows line endings, but read in� Docker image is created successfully. I need to run .sh file after logging into windows container. However i am not able to run any .sh file. If i run .sh file, nothing happens. c:\WorkSpace\dbscripts>bash c:\WorkSpace\dbscripts> bash is present on container as Git is installed. c:\WorkSpace\dbscripts>where bash c:\git\bin\bash.exe

you mounted the directory from your win host to the docker machine. I BELIEVE this is a permission problem - the file is not executable flagged. Show detailed listing

# ls -lh

copy the folder to internal dir and add executable bit

cp /home/tmp /home/tmp2 -r
chmod +x /home/tmp2/*.sh

/bin/sh: 1: ./ not found on docker for windows using linux , I have tried to run docker-compose up -d in windows and I get the following error. not found ERROR: Service 'wp-headless' failed to build: The Actually, I get this error: Can't find a suitable configuration file in this� Here if you notice, there are three new files docker-compose-peer2. apk add bash No Permission. SSH into a Docker container using this command: sudo docker exec -i -t (container ID) bash. sh is missing the execute bit. docker/ directory was created with incorrect permissions due to the sudo commands.

It seems in order to execute my .sh file I need to run it like this


So I added

CMD ["sh", ""]

And I started to work (though failed with other errors like missing make etc. but that's due to missing packages in Alpine Linux itself so a separate matter).

Guess It is something to do with Alpine Linux itself. But I am not sure.

Issues using /bin/sh in CMD command in scratch docker container , Issues using /bin/sh in CMD command in scratch docker container #17896 no such file or director" error is saying that the required libraries can't be found. Not knowing why Docker wasn’t running on my System (remember, it was opening the Bash sell script in WordPad), following the instructions in Git issue #31, I uninstalled Git SCM as well as Boot2Docker and VirtualBox, rebooted, performed a full install of Docker (all three components, including MSYS-Git), and rebooted again for good measure.

Docker CMD VS Entrypoint commands: What's the difference?, Long story short, you can tell Docker to run the command bash , which drops you into a shell: and stop when it gets to a command that does not exit properly. FROM continuumio/miniconda3:latest RUN apt-get update -y;� $ docker container ls -a. The above command will list containers in any state: (created, running, or exited). Sometimes, you may want to just list the IDs of all the containers. For this, you have the -q parameter: $ docker container ls -q. You might wonder where this is useful. Here’s an example: $ docker container rm -f $(docker container

Docker Exec, By default that Unix socket is owned by the user root and other users can only cannot run correctly if your kernel is older than version 3.10 or if it is missing� The container has nothing to do with it. The extension simply cannot find the docker executable on the host, unless the editor is opened using the terminal and inherits its environment. Obviously, if it can't find the docker executable, then it isn't going to be able to attach to any containers. To be clear, this is a fresh install of VSCode.

Post-installation steps for Linux, This will create a container named ubuntu_bash and start a Bash session. Next, execute a command on the container. $ docker exec -d ubuntu_bash touch /tmp/ � This script uses the exec Bash command so that the final running application becomes the container’s PID 1. This allows the application to receive any Unix signals sent to the container. For more, see the ENTRYPOINT reference. The helper script is copied into the container and run via ENTRYPOINT on container start:

  • why do you say it does not find the entrypoint? Can you share your dockerfile?
  • @JoseAngelSanchez But there is a docker file on the top of the post. I just removed Entrypoint as it didn't work anyway as I attempted to run the script from inside the container. It was simple ENTRYPOINT ./
  • that's the part I want to see, I think the problem is there, the best way to do this is with the ENTRYPOINT command, we should figure out why it is failing
  • It seems to be working when I execute script via sh I am using Alpine Linux, so maybe problem with that
  • Usually you'd run the sorts of "compile" commands you show during the course of building an image, not when the image starts up That is exactly what I want to achieve.
  • BTW docker for windows brings so many difficulties with mounting host folders ... this makes no fun
  • same issue /bin/sh: /home/tmp2/ not found listing is -rwxr-xr-x 1 0 0 152 Dec 16 22:21 Dockerfile -rwxr-xr-x 1 0 0 316 Dec 16 21:44 drwxrwxrwx 2 0 0 0 Dec 16 21:12 sdk-develop
  • the thing it in the past I did the same multiple times - I do it even now though I run python scripts from inside another docker project. however for some reason here it didn't work. If I create simply python file inside the folder and run inside the container via python it works fine.