在windows docker容器环境下运行shell脚本start.sh无法正确识别,提示XSym: command not found

D:\Users\W9013134>docker ps
CONTAINER ID   IMAGE                                                 COMMAND   CREATED          STATUS          PORTS                    NAMES
f583ad35a254   devhub.baymax.oppoer.me/member-rpc/hyperf-node:v2.0   "bash"    21 seconds ago   Up 13 seconds   0.0.0.0:8080->8080/tcp   server-client-test-1
c61ae7ad3f34   devhub.baymax.oppoer.me/member-rpc/hyperf-node:v2.0   "bash"    3 hours ago      Up 3 hours      0.0.0.0:8099->8000/tcp   server-member-open-api-1
841ca72e021b   devhub.baymax.oppoer.me/member-rpc/hyperf-node:v2.0   "bash"    5 hours ago      Up 3 hours      0.0.0.0:8000->8000/tcp   server-member-client-api-1

D:\Users\W9013134>docker exec -it server-client-test-1 bash
[root@f583ad35a254 /]# cd /var/www/bin
[root@f583ad35a254 bin]# ls
hyperf.php
[root@f583ad35a254 bin]# cd ../vendor/bin
[root@f583ad35a254 bin]# ls
carbon  co-phpunit  php-cs-fixer  php-parse  phpstan  phpstan.phar  phpunit  start.sh
[root@f583ad35a254 bin]# cat -A start.sh
XSym$
0035$
772a75c8f1277b0eb3fbb1f956dcd085$
../oppo-member/lib/src/bin/start.sh$
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^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@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
[root@f583ad35a254 bin]# bash start.sh
start.sh: line 1: XSym: command not found
start.sh: line 2: 0035: command not found
start.sh: line 3: 772a75c8f1277b0eb3fbb1f956dcd085: command not found
Could not open input file: bin/hyperf.php
[root@f583ad35a254 bin]# 
[root@f583ad35a254 bin]# sh start.sh
start.sh: line 1: XSym: command not found
start.sh: line 2: 0035: command not found
start.sh: line 3: 772a75c8f1277b0eb3fbb1f956dcd085: command not found
Could not open input file: bin/hyperf.php
[root@f583ad35a254 bin]# ll
total 32
-rwxrwxrwx 1 root root 1067 Dec  9  2021 carbon
-rwxrwxrwx 1 root root 1067 Dec  9  2021 co-phpunit
-rwxrwxrwx 1 root root 1067 Dec  9  2021 php-cs-fixer
-rwxrwxrwx 1 root root 1067 Dec  9  2021 php-parse
-rwxrwxrwx 1 root root 1067 Dec  9  2021 phpstan
-rwxrwxrwx 1 root root 1067 Dec  9  2021 phpstan.phar
-rwxrwxrwx 1 root root 1067 Dec  9  2021 phpunit
-rwxrwxrwx 1 root root 1067 Dec  7 02:00 start.sh
[root@f583ad35a254 bin]# chmod 777 start.sh
[root@f583ad35a254 bin]# ./start.sh
./start.sh: line 1: XSym: command not found
./start.sh: line 2: 0035: command not found
./start.sh: line 3: 772a75c8f1277b0eb3fbb1f956dcd085: command not found
Could not open input file: bin/hyperf.php
[root@f583ad35a254 bin]# ll
total 32
-rwxrwxrwx 1 root root 1067 Dec  9  2021 carbon
-rwxrwxrwx 1 root root 1067 Dec  9  2021 co-phpunit
-rwxrwxrwx 1 root root 1067 Dec  9  2021 php-cs-fixer
-rwxrwxrwx 1 root root 1067 Dec  9  2021 php-parse
-rwxrwxrwx 1 root root 1067 Dec  9  2021 phpstan
-rwxrwxrwx 1 root root 1067 Dec  9  2021 phpstan.phar
-rwxrwxrwx 1 root root 1067 Dec  9  2021 phpunit
-rwxrwxrwx 1 root root 1067 Dec  7 02:00 start.sh
[root@f583ad35a254 bin]#


正常的没被转化成二进制的start.sh文件内容如下:
#!/bin/bash

cd $(dirname $0)

cd ../../

logDir="/home/service/var/logs"

if [ -d ${logDir} ];then
  mkdir -p ${logDir}
fi

php bin/hyperf.php start   
可识别执行成功
[root@23126004eb75 bin]# ls
carbon  co-phpunit  php-cs-fixer  php-parse  phpstan  phpstan.phar  phpunit  start.sh
[root@23126004eb75 bin]# ./start.sh
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Config\Listener\RegisterPropertyHandlerListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Oppo\Hyperf\JsonRpc\RegisterProtocolListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Oppo\Hyperf\GrpcClient\Listener\AddConsumerDefinitionListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\RpcClient\Listener\AddConsumerDefinitionListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Paginator\Listener\PageResolverListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\JsonRpc\Listener\RegisterProtocolListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\ExceptionHandler\Listener\ExceptionHandlerListener listener.                          

找的部分网上资料
https://learnku.com/laravel/t/42181
https://stackoverflow.com/questions/54732023/xsym-not-found-while-executing-binary-in-docker-on-windows
https://ithelp.ithome.com.tw/articles/10234655
https://blog.csdn.net/ron03129596/article/details/124832706

Windows10 WSL1 安装Docker

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值