Tag: docker tomcat7

在Docker容器中运行Maven Web应用程序

我试图用Maven构build一个简单的Web应用程序,并在Docker容器内运行Tomcat7。 这是我的结构: – Dockerfile – pom.xml – src/main/webapp/index.hmtl 这是我的Dockerfile: FROM java:8 # Install maven RUN apt-get -y update && apt-get install -y maven WORKDIR /code # Prepare by downloading dependencies ADD pom.xml /code/pom.xml # Adding source, compile and package into a fat jar ADD src /code/src RUN ["mvn", "package"] EXPOSE 8080 CMD ["mvn", "tomcat7:run"] 我正在构buildDocker镜像 […]

无法使用Docker将Java程序连接到MySQL

我正在学习docker,并尝试使用Tomcat将我的Java Web应用程序放到容器中。 我跟着一些基本的教程,但我发现没有解决scheme正常工作给我。 如果我运行我的数据库和Java容器,我得到的错误: SEVERE: Unable to create initial connections of pool. com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:404) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:981) at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:339) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253) […]