docker 里面运行sh命令一直没有权限

最开始是挂载的sh文件,一直被拒绝,然后我在dockerfile里面写了copy,把sh文件复制到容器里面运行还是,permission denied,原来就是真么写的 从来没出过问题,今天改了点别的地方,突然这就不行了。

在docker-compose.yml加上了privileged: true,然后command里执行sh /sh/wait-for-it.sh mysql:3306 -s -t 3600 -- **其他命令,容器一直处于restarting,logs查看报错如下:

timeout: failed to run command '/sh/wait-for-it.sh': Permission denied
wait-for-it.sh: timeout occurred after waiting 3600 seconds for mysql:3306
wait-for-it.sh: strict mode, refusing to execute subprocess

https://www.cnblogs.com/yddzyy/p/13298482.html