-1

We are trying to build a Python-flask image on Windows 10 machine and here are the commands that are part of Dockerfile.

RUN chmod +x /var/www/projectname/entrypoint.local.sh

We are getting an error while trying to build the image using docker file

Here is the error:

chmod : The term 'chmod' is not recognized as the name of a cmdlet, function,  script file, or operable program. Check the spelling of the name, or if a path  was included, verify that the path is correct and try again. At line:1 char:76
+ ... nce = 'Stop'; $ProgressPreference = 'SilentlyContinue'; chmod +x /var ...
+                                                             ~~~~~
    + CategoryInfo          : ObjectNotFound: (chmod:String) [], ParentContain     sErrorRecordException
    + FullyQualifiedErrorId : CommandNotFoundException   ERROR: Service 'controller_service' failed to build: The command 'powershell
-Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; chmod +x /var/www/projectname/entry point.local.sh' returned a non-zero code: 1

It is considering chmod which is in Dockerfile as Windows command.

Edit1:

I'm trying to build the image as part of docker-compose using the below command:

docker-compose up --build.

I'm running the above command in Terminal in Pycharm in Windows.

Please suggest any fix for this issue. Thanks!

0

1 Answer 1

0

It looks like you're trying to build the Linux images when you've actually configured your Docker desktop to build Windows images.

That's the reason you might be getting the error chmod command not found which is specific to Linux and won't work on Windows.

You can follow these steps to resolve it.

  1. Go to the Docker desktop icon on the bottom right corner on in task bar.
  2. Right click and click on option to Switch to Linux containers.
  3. Try to build the images now.

You should be good to go.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.