1、拉取tomcat服务镜像文件

root@ubuntu:~# docker pull registry.cn-hangzhou.aliyuncs.com/xxxx/xxxxx:web
web: Pulling from registry.xxxxxxx/xiaoyaoji
0586e6d4e45e: Extracting [==============> ] 19.5 MB/67.1 MB
0586e6d4e45e: Pulling fs layer
0586e6d4e45e: Downloading [==============================> ] 40.38 MB/67.1 MB
15d45afac408: Download complete
9b8cebd39bac: Download complete
62ca1091452a: Download complete
07570fbab17a: Download complete
889ff497587a: Downloading [===========================> ] 103.3 MB/186.5 MB

2、通过镜像生成容器

root@ubuntu:~# docker run -d -p : registry.cn-hangzhou.xxxxxx:web
fdcbab15879c0e0f73377a37e7da1a9da4348e7a47308aab8fac2198c38fe2a8
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fdcbab15879c registry.cn-hangzhou.aliyuncs.com/xxxxxx:web "/bin/sh -c 'exec /u 4 seconds ago Up 3 seconds 0.0.0.0:80->8080/tcp berserk_kowalevski
d321e7650228 registry.cn-hangzhou.aliyuncs.xxxxxxxxx "/usr/local/mysql/bi 47 minutes ago Up 47 minutes 22/tcp, 0.0.0.0:4406->3306/tcp admiring_franklin

3、测试服务是否启动

4、进入容器

5、 编辑Tomcat容器内配置文件、修改端口信息等

6、修改数据库配置文件信息。

7、重启tomcat容器

root@ubuntu:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fdcbab15879c registry.xxxxx:web "/bin/sh -c 'exec /u 17 minutes ago Up 17 minutes 0.0.0.0:80->8080/tcp berserk_kowalevski
d321e7650228 registry.xxxxx:v2 "/usr/local/mysql/bi About an hour ago Up About an hour 22/tcp, 0.0.0.0:4406->3306/tcp admiring_franklin
root@ubuntu:~# docker restart fdcbab15879c
fdcbab15879c
root@ubuntu:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fdcbab15879c registry.xxxx:web "/bin/sh -c 'exec /u 17 minutes ago Up 3 seconds 0.0.0.0:80->8080/tcp berserk_kowalevski
d321e7650228 registry.xxxxx/mysql:v2 "/usr/local/mysql/bi About an hour ago Up About an hour

重启项目:

8、再次进入Tomcat容器,查看日志文件信息。

root@ubuntu:~# docker restart fdcbab15879c
fdcbab15879c
root@ubuntu:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fdcbab15879c registry.xxxxxx/xiaoyaoji:web "/bin/sh -c 'exec /u 17 minutes ago Up 3 seconds 0.0.0.0:80->8080/tcp berserk_kowalevski
d321e7650228 registry.xxxxxx/mysql:v2 "/usr/local/mysql/bi About an hour ago Up About an hour 22/tcp, 0.0.0.0:4406->3306/tcp admiring_franklin
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# docker exec -it fdcbab15879c bash
root@fdcbab15879c:/#
root@fdcbab15879c:/#
root@fdcbab15879c:/#
root@fdcbab15879c:/#
root@fdcbab15879c:/# cd /usr/local/tomcat/apache-tomcat-7.0./logs/xyj
root@fdcbab15879c:/usr/local/tomcat/apache-tomcat-7.0./logs/xyj# ls
error.log
root@fdcbab15879c:/usr/local/tomcat/apache-tomcat-7.0./logs/xyj# tail -200f error.log
at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:)
-- ::, ERROR Druid-ConnectionPool-Create- com.alibaba.druid.pool.DruidDataSource - create connection error, url: jdbc:mysql://192.168.3.111:4406/api?useUnicode=true&characterEncoding=utf8, errorCode 1045, state 28000
java.sql.SQLException: Access denied for user 'root'@'172.17.42.1' (using password: NO)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:)
at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:)
at sun.reflect.GeneratedConstructorAccessor23.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:)
at java.lang.reflect.Constructor.newInstance(Constructor.java:)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:)
at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:)
at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilter.java:)
at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:)
-- ::, ERROR http-bio--exec- cn.com.xiaoyaoji.data.DataFactory - wait millis , active , maxActive
com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis , active , maxActive
at com.alibaba.druid.pool.DruidDataSource.getConnectionInternal(DruidDataSource.java:)
at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:)
at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:)
at com.alibaba.druid.filter.stat.StatFilter.dataSource_getConnection(StatFilter.java:)
at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:)
at cn.com.xiaoyaoji.util.JdbcUtils.getConnect(JdbcUtils.java:)
at cn.com.xiaoyaoji.data.DataFactory.process(DataFactory.java:)
at cn.com.xiaoyaoji.data.DataFactory.checkEmailExists(DataFactory.java:)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
at java.lang.reflect.Method.invoke(Method.java:)
at cn.com.xiaoyaoji.data.DataFactory$.invoke(DataFactory.java:)
at com.sun.proxy.$Proxy31.checkEmailExists(Unknown Source)
at cn.com.xiaoyaoji.service.ServiceFactory.checkEmailExists(ServiceFactory.java:)
at cn.com.xiaoyaoji.controller.UserController.create(UserController.java:)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
at java.lang.reflect.Method.invoke(Method.java:)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:)
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:)
at org.apache.catalina.valves.AccessLogValve.invo

Doker容器部署Tomcat服务器的更多相关文章

  1. Docker容器部署tomcat出现中文乱码

    docker 容器部署tomcat后,日志文件中出现中文乱码,很多问号,中文的文件夹也是问好.先看看容器的locale: [root@docker1 ~]# docker exec -it 41de9 ...

  2. 二十二. 安装部署Tomcat服务器、使用Tomcat部署虚拟主机、使用Varnish加速Web

    web proxy web1 web2   1.安装部署Tomcat服务器 web1 1.1 使用RPM安装JDK环境 ]# yum -y install java-1.8.0-openjdk ]# ...

  3. Linux系统下部署Tomcat服务器

    详细步骤如下: 1.下载xshell5和xftp5并安装,登录连接服务器,新建会话窗口: 2.安装配置JDK1.8,具体操作方法如下: (1)下载JDK地址:http://www.oracle.com ...

  4. 部署Tomcat服务器

    部署Tomcat服务器,具体内容如下: 1.安装部署JDK基础环境; 2.安装部署Tomcat服务器; 3.创建JSP测试页面,文件名为test.jsp,显示服务器当前时间. 然后客户机访问Web服务 ...

  5. 高级运维(四):Nginx常见问题处理、安装部署Tomcat服务器、使用Tomcat部署虚拟主机

    一.Nginx常见问题处理 目标: 本案例要求对Nginx服务器进行适当优化,以提升服务器的处理性能: 1> 不显示Nginx软件版本号 2> 如果客户端访问服务器提示“Too many ...

  6. 安装部署Tomcat服务器

                      安装部署Tomcat服务器 案例1:安装部署Tomcat服务器 案例2:使用Tomcat部署虚拟主机 案例3:使用Varnish加速Web 1案例1:安装部署Tom ...

  7. 云服务器Centos7部署Tomcat服务器

    目录 部署Tomcat服务器 1.安装JDK1.8 2.安装与启动tomcat 配置安全组(8080端口) 参考文章 部署Tomcat服务器 1.安装JDK1.8 JDK下载地址:https://ww ...

  8. Web容器(tomcat服务器)处理JSP文件请求的三个阶段

    Web容器(tomcat服务器)处理JSP文件请求的三个阶段 翻译:编写好的jsp文件被web容器中的jsp引擎转换成java源码. 编译:翻译成java源码的jsp文件会被编译成可被计算机执行的字节 ...

  9. FineReport如何部署Tomcat服务器集群

    环境准备 Tomcat服务器集群中需要进行环境准备: Apache:Apache是http服务器,利用其对Tomcat进行负载均衡,这里使用的版本是Apache HTTP Server2.0.64: ...

随机推荐

  1. 题解:[HAOI2008]下落的圆盘

    时空限制:1000ms / 128MB 原题链接: 洛谷 bzoj Description 有n个圆盘从天而降,后面落下的可以盖住前面的.求最后形成的封闭区域的周长.看下面这副图, 所有的红 色线条的 ...

  2. 22、pandas表格、文件和数据库模块

    pandas官方文档:https://pandas.pydata.org/pandas-docs/stable/?v=20190307135750 pandas基于Numpy,可以看成是处理文本或者表 ...

  3. Linux SSH 连接安全设置

    一.更换端口, 可以在一定程度上防止扫描攻击 vim /etc/ssh/sshd_config 将 port 一项从 22 更改为高位端口, 然后重启 ssh 服务 systemctl restart ...

  4. wordpress调用置顶文章sticky_posts的三种方法

    有时我们在开发wordpress时需要调用置顶文章sticky_posts,怎么调用呢?几种写法,有用到query_post的,有用到WP_Query,也有用到is_sticky(),下面随ytkah ...

  5. TCP/IP通信过程(以发送电子邮件为例)(转)

    1.应用程序处理 (1)A用户启动邮件应用程序,填写收件人邮箱和发送内容,点击“发送”,开始TCP/IP通信: (2)应用程序对发送的内容进行编码处理,这一过程相当于OSI的表示层功能: (3)由A用 ...

  6. Git git2.8.1客户端安装教程

    Git git2.8.1客户端安装教程 一 Git介绍 git是一款免费.开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目. 分布式相比于集中式的最大区别在于开发者可以提交到本地,每个开 ...

  7. Longest Common Substring SPOJ - LCS (后缀自动机)

    Longest Common Substring \[ Time Limit: 294ms \quad Memory Limit: 1572864 kB \] 题意 给出两个串,求两个串的最长公共连续 ...

  8. html 复习(for循环不同内容的div)

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  9. DT包 -- R语言中自定义表格数据

    DT 包提供了 JavaScript 库 DataTables 的一个R接口,它使得R对象(矩阵或数据框)可以在HTML页面上显示为表格. 该包的DataTables函数生成的表格提供了数据的筛选.分 ...

  10. Spring Cloud Feign 调用过程分析

    前面已经学习了两个Spring Cloud 组件: Eureka:实现服务注册功能: Ribbon:提供基于RestTemplate的HTTP客户端并且支持服务负载均衡功能. 通过这两个组件我们暂时可 ...