linux - docker部署tomcat服务下web服务
ringa_lee
ringa_lee 2017-04-17 13:50:52
0
3
411

我用docker创建镜像
dockerfile文件内容如下:

FROM daocloud.io/library/centos
MAINTAINER lun9090 <643812461@qq.com>
ADD apache-tomcat-6.0.41 /opt/apache-tomcat-6.0.41
RUN cd /opt/ && mv apache-tomcat-6.0.41 tomcat
ADD jdk-6u45-linux-x64.bin /opt/
RUN cd /opt && chmod +x jdk-6u45-linux-x64.bin && ./jdk-6u45-linux-x64.bin && mv jdk1.6.0_45 jdk && rm jdk-6u45-linux-x64.bin
ADD web-server /opt/tomcat/webapps/web-server
ENV JAVA_HOME /opt/jdk
ENV JRE_HOME $JAVA_HOME/jre
ENV CLASSPATH .:$JAVA_HOME/lib:$JRE_HOME/lib
ENV PATH $PATH:$JAVA_HOME/bin
CMD /opt/tomcat/bin/catalina.sh run

web-server是基于uap开发的应用,总是加载不上,启动容器后的log日志如下:

[root@docker1 uap]# docker logs -f eb9108ca79e0
Dec 8, 2015 7:29:27 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: /opt/jdk/jre/lib/amd64/server:/opt/jdk/jre/lib/amd64:/opt/jdk/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Dec 8, 2015 7:29:28 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Dec 8, 2015 7:29:28 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1894 ms
Dec 8, 2015 7:29:28 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Dec 8, 2015 7:29:28 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.41
Dec 8, 2015 7:29:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Dec 8, 2015 7:29:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
Dec 8, 2015 7:29:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
Dec 8, 2015 7:29:30 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory host-manager
Dec 8, 2015 7:29:30 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory manager
Dec 8, 2015 7:29:30 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory sguap-server
Dec 8, 2015 7:29:30 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Dec 8, 2015 7:29:30 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Dec 8, 2015 7:29:30 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/18  config=null
Dec 8, 2015 7:29:30 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2501 ms

这是怎么回事啊?

ringa_lee
ringa_lee

ringa_lee

全部回覆(3)
洪涛

其實我強烈建議你用spring boot之類的東西把容器和你的war打包成一個可以直接運行的jar,然後你就不煩惱了。

大家讲道理

@jokester 這個服務是基於osgi的動態服務, 在容器中能夠正常啟動,但是不知道為啥封裝好了就不能啟動了,無法加載osgi

迷茫

dockerfile中也沒指定連接埠啊

你啟動的時候做埠映射了麼?

docker inspect看一下容器的ip

然後訪問ip:8080試試撒

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!