Shell 脚本无法在没有此类文件或目录的情况下运行
我创建了一个docker映像,最后运行一个脚本,在启动时配置我的容器 docker文件中执行脚本的部分如下所示Shell 脚本无法在没有此类文件或目录的情况下运行,shell,unix,docker,permissions,Shell,Unix,Docker,Permissions,我创建了一个docker映像,最后运行一个脚本,在启动时配置我的容器 docker文件中执行脚本的部分如下所示 RUN chmod +x /scratch/software/config/config.sh CMD /scratch/software/config/config.sh echo "Starting WLS" whoami echo $DOMAIN_HOME cd $DOMAIN_HOME pwd ls -ltr ./bin/ sh ./bin/startWeblogic.sh
RUN chmod +x /scratch/software/config/config.sh
CMD /scratch/software/config/config.sh
echo "Starting WLS"
whoami
echo $DOMAIN_HOME
cd $DOMAIN_HOME
pwd
ls -ltr ./bin/
sh ./bin/startWeblogic.sh
tail -f -n0 /etc/hosts
脚本如下所示
RUN chmod +x /scratch/software/config/config.sh
CMD /scratch/software/config/config.sh
echo "Starting WLS"
whoami
echo $DOMAIN_HOME
cd $DOMAIN_HOME
pwd
ls -ltr ./bin/
sh ./bin/startWeblogic.sh
tail -f -n0 /etc/hosts
那些whoami pwd等仅用于调试目的。输出为:
Starting WLS
root
/scratch/software/Oracle/Middleware/Wls122120/user_projects/domains/fa_domain
/scratch/software/Oracle/Middleware/Wls122120/user_projects/domains/fa_domain
total 108
drwxr-x--- 2 root root 4096 Feb 11 07:22 service_migration
drwxr-x--- 2 root root 4096 Feb 11 07:22 server_migration
drwxr-x--- 2 root root 4096 Feb 11 07:22 patching
drwxr-x--- 2 root root 4096 Feb 11 07:22 nodemanager
-rwxr-x--- 1 root root 2166 Feb 11 07:27 stopWebLogic.sh
-rwxr-x--- 1 root root 889 Feb 11 07:27 stopRSDaemon.sh
-rwxr-x--- 1 root root 1153 Feb 11 07:27 stopNodeManager.sh
-rwxr-x--- 1 root root 2699 Feb 11 07:27 stopManagedWebLogic.sh
-rwxr-x--- 1 root root 1985 Feb 11 07:27 stopComponent.sh
-rwxr-x--- 1 root root 7211 Feb 11 07:27 startWebLogic.sh
-rwxr-x--- 1 root root 725 Feb 11 07:27 startRSDaemon.sh
-rwxr-x--- 1 root root 1832 Feb 11 07:27 startNodeManager.sh
-rwxr-x--- 1 root root 2928 Feb 11 07:27 startManagedWebLogic.sh
-rwxr-x--- 1 root root 2321 Feb 11 07:27 startComponent.sh
-rwxr-x--- 1 root root 21083 Feb 11 07:27 setStartupEnv.sh
-rwxr-x--- 1 root root 925 Feb 11 07:27 setNMJavaHome.sh
-rwxr-x--- 1 root root 14566 Feb 11 07:27 setDomainEnv.sh
-rwxr-x--- 1 root root 2675 Feb 11 07:27 generateArchive.sh
sh: ./bin/startWeblogic.sh: No such file or directory
我不知道为什么它说没有这样的文件或目录正如我在上面的评论中提到的,脚本调用
sh./bin/startwebogic.sh
,其中startwebogic
在logic
上没有大写字母,而在文件列表中你有startwebogic
l
?因此:startwebogic.sh
vsstartwebogic.sh
无法相信这是一个如此愚蠢的错误。最愚蠢的错误之一也许你可以删除你的问题。