close

[Solved] Docker image : “/bin/sh: 1: [python,: not found”

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Docker image : “/bin/sh: 1: [python,: not found” in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Docker image : “/bin/sh: 1: [python,: not found” Error Occurs?

Today I get the following error Docker image : “/bin/sh: 1: [python,: not found” in python.

How To Solve Docker image : “/bin/sh: 1: [python,: not found” Error ?

  1. How To Solve Docker image : “/bin/sh: 1: [python,: not found” Error ?

    To Solve Docker image : “/bin/sh: 1: [python,: not found” Error If you don't clear cached images, docker will use cached image with some crazy whitespace chars, which was created the same error message like the subject of the thread.

  2. Docker image : “/bin/sh: 1: [python,: not found”

    To Solve Docker image : “/bin/sh: 1: [python,: not found” Error If you don't clear cached images, docker will use cached image with some crazy whitespace chars, which was created the same error message like the subject of the thread.

Solution 1

I have resolved my issue on my Mac by changing

CMD ["python", "app.py"]

to

CMD python app.py

Solution 2

I had similar issue, but I didn’t have any ' or " chars in docker run command in my case. But I found the solution to repair that issue and maybe will help you in similar case in future:

  1. Clear all unnecessary whitespace chars from Dockerfile
  2. Clear all cached images from this Dockerfile
  3. Build and run new image

If you don’t clear cached images, docker will use cached image with some crazy whitespace chars, which was created the same error message like the subject of the thread.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read