我正在尝试使用安装说明libreplan为here创建一个docker版本。 dockerfile是
FROM tomcat:6
RUN apt-get -yq update && apt-get -yq install \
cutycapt \
patch \
postgresql-client \
libpg-java \
xvfb
# Prepare webapp location
RUN mkdir -p /usr/local/tomcat/webapps/libreplan
# Get WAR file
RUN wget -q -O /usr/local/tomcat/webapps/libreplan/libreplan.war http://downloads.sourceforge.net/project/libreplan/LibrePlan/libreplan_1.3.0.war
# Install libreplan.xml
ADD libreplan.xml /usr/local/tomcat/webapps/libreplan/libreplan.xml
# Patch the policy to include libreplan
ADD catalina.policy.patch catalina.policy.patch
RUN patch -o /usr/local/tomcat/conf/catalina.policy /usr/local/tomcat/conf/catalina.policy catalina.policy.patch
CMD ["catalina.sh", "run"]
构建有效,但在尝试运行时却没有做任何事情。所有代码都在github上,我已在docker registry上设置了自动构建。 repo中包含一个示例docker-compose.yml应该可以使用,但是当我尝试它时,libreplan容器中没有显示输出,我无法通过浏览器访问它。我根本不认识tomcat,所以这可能是我做错了,但我不知道如何开始搞清楚什么。有什么明显的我错过了吗?
答案 0 :(得分:0)
如果我运行您的图片:
$ docker run --name libreplan aquavitae/libreplan
我明白了:
May 28, 2015 4:57:42 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
May 28, 2015 4:57:42 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
May 28, 2015 4:57:42 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 387 ms
May 28, 2015 4:57:42 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
May 28, 2015 4:57:42 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.44
May 28, 2015 4:57:42 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory host-manager
May 28, 2015 4:57:42 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory manager
May 28, 2015 4:57:42 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
May 28, 2015 4:57:42 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory libreplan
May 28, 2015 4:57:42 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
May 28, 2015 4:57:42 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
May 28, 2015 4:57:42 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
May 28, 2015 4:57:42 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
May 28, 2015 4:57:42 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/12 config=null
May 28, 2015 4:57:42 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 580 ms
这似乎完全成功。此外,我可以抓住IP 容器的地址:
$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' libreplan
172.17.0.9
在浏览器中打开它:
$ firefox http://172.17.0.9:8080
并查看默认的Tomcat网页。
所以大部分情况似乎都有效。
虽然我将docker up
行替换为build: .
,但我也可以image: aquavitae/libreplan
没有错误,因为我没有足够的耐心尝试构建。
答案 1 :(得分:-1)
确定在这种情况下,您必须通过在容器中运行shell并手动启动进程来进行故障排除。如果你很幸运docker logs containername
可能有足够的信息让你理解什么是错的,但通常我最终都要按照以下方式进入容器:
docker run --interactive --tty --link db:db <containerid> bash
进入后,您将直接运行您的CMD。
catalina.sh run
查看您的文件,我的第一个想法是catalina.sh
不在您的PATH中或不在可执行文件中。因此,您可以通过运行/bin/sh /full/path/to/catalina.sh run
或调整PATH环境变量和/或使用Dockerfile中的WORKDIR指令来解决此问题。