我正在尝试在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 for 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;;
答案 0 :(得分:1)
查看有错误的行号(第2行,第17行,第23行等)。 看来这些都是在有新线的时候发生的。
检查您的startup.sh
文件设置,应该是LF 而不是CRLF。我确实用LF检查了脚本,它正在使用centOS 6。
如果您使用Windows构建Docker容器,可以查看Running Scripts in a Docker Container from Windows- CR or CRLF以获取更多信息。