在docker centos中启动tomcat服务器时出错

我试图启动一个运行在docker容器内的centos中的apache服务器。 在我的Dockerfile中,运行服务器,我有以下命令:

FROM centos:6 #(few commands) CMD sleep 60 && sh /opt/liferay/liferay/tomcat-6.0.32/bin/startup.sh && tail -f /opt/liferay/liferay/tomcat-6.0.32/logs/catalina.out 

但是我得到以下错误运行startup.sh为Apache。

 : command not founday/liferay/tomcat-6.0.32/bin/startup.sh: line 2: : command not founday/liferay/tomcat-6.0.32/bin/startup.sh: line 17: : command not founday/liferay/tomcat-6.0.32/bin/startup.sh: line 23: 'eb_1 | /opt/liferay/liferay/tomcat-6.0.32/bin/startup.sh: line 27: syntax error near unexpected token `in 'eb_1 | /opt/liferay/liferay/tomcat-6.0.32/bin/startup.sh: line 27: `case "`uname`" in 

这里是我的startup.sh的前30行

 #!/bin/sh # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ----------------------------------------------------------------------------- # Start Script for the CATALINA Server # # $Id: startup.sh 562770 2007-08-04 22:13:58Z markt $ # ----------------------------------------------------------------------------- # Better OS/400 detection: see Bugzilla 31132 os400=false darwin=false case "`uname`" in CYGWIN*) cygwin=true;; OS400*) os400=true;; Darwin*) darwin=true;; 

看到有错误的行号(第2,第17,第23行等)。 看来,这些都是在有新的路线的时候发生的。

检查你的startup.sh文件设置,它应该是LF而不是CRLF。 我没有用LF检查脚本,它正在使用centOS 6。

如果您使用Windows构buildDocker容器,则可以查看来自Windows-CR或CRLF的Docker容器中的运行脚本以获取更多信息。