我正在运行openjdk:13-alpine docker 容器并将 garmin connectiq-sdk 文件挂载到容器中。尝试运行 monkeyc 命令失败,并显示"未找到"。
~/projects/garmin$ docker container run --rm -it --name monkeyc -v $(pwd):/home/garmin/ -w /home/garmin/ openjdk:13-alpine ash
/home/garmin # ./connectiq-sdk/bin/monkeyc --version
ash: ./connectiq-sdk/bin/monkeyc: not found
在容器外部,命令按预期工作
~/projects/garmin$ ./connectiq-sdk/bin/monkeyc --version
Connect IQ compiler version 3.0.3
monkeyc 命令是一个 bash 脚本。Bash shell 没有安装在容器中的 alpine Linux 上。应该改用灰壳。在猴子脚本中从 bash 切换到 ash 有效。
~/projects/garmin$ docker container run --rm -it --name monkeyc -v $(pwd):/home/garmin/ -w /home/garmin/ openjdk:13-alpine ash
/home/garmin # ./connectiq-sdk/bin/monkeyc --version
ash: ./connectiq-sdk/bin/monkeyc: not found
/home/garmin # cat ./connectiq-sdk/bin/monkeyc
#!/bin/bash
MB_HOME="$( cd "$( dirname "$0" )" && pwd )"
java -classpath "$MB_HOME"/monkeybrains.jar com.garmin.monkeybrains.Monkeybrains "$@"
/home/garmin # vi ./connectiq-sdk/bin/monkeyc
/home/garmin # ./connectiq-sdk/bin/monkeyc --version
Connect IQ compiler version 3.0.3
/home/garmin # cat ./connectiq-sdk/bin/monkeyc
#!/bin/ash
MB_HOME="$( cd "$( dirname "$0" )" && pwd )"
java -classpath "$MB_HOME"/monkeybrains.jar com.garmin.monkeybrains.Monkeybrains "$@"