-2

unable to execute bash in docker container :ubuntu

this is my bash script (its calling):

#!/bin/sh

php bin/magento cache:clean
php bin/magento cache:flush

it in turn calls this script:

> #!/usr/bin/env php <?php /**  * Copyright © Magento, Inc. All rights reserved.  * See COPYING.txt for license details.  */
> 
> if (PHP_SAPI !== 'cli') {
>     echo 'bin/magento must be run as a CLI application';
>     exit(1); }

this is the error message :

root@a72397092db6:/var/www/html# ./bins/clean
bash: ./bins/clean: Permission denied
root@a72397092db6:/var/www/html# 

I would like the script to execute . I do have permissions to execute it. this is the permission for the directory.

-rw-r--r--  1 1000 root   68 Jul 23 14:07 clean
-rw-r--r--  1 1000 root  234 Jul 23 14:07 compile
-rw-r--r--  1 1000 root 6148 Jul 23 14:28 .DS_Store
-rw-r--r--  1 1000 root  118 Jul 23 14:07 permissions
theSeeker
  • 297
  • 4
  • 12
  • This question has many duplicates, e.g. https://stackoverflow.com/questions/18960689/ubuntu-says-bash-program-permission-denied Just googling "bash execute permissions denied" would have lead to the answer. – ales_t Jul 23 '19 at 15:25

1 Answers1

1

You don't have permissions to execute (x) it unless you give them to yourself:

chmod +x ./bins/clean

You need the permissions to look like this (provided you'll run the script as root which you probably will since it's in Docker):

-rwxr--r--  1 1000 root   68 Jul 23 14:07 clean
ales_t
  • 1,967
  • 11
  • 10