简体   繁体   English

如何使用Docker构建J2EE应用程序

[英]How to build an J2EE application with docker

I have always been confused with this question.From my point of view, docker is been used to wrap the application inside it for developing(make a volume), testing and deploying. 我一直对这个问题感到困惑。从我的角度来看,docker被用于将应用程序包装在其中以进行开发(制作卷),测试和部署。 My question is, building a J2EE using maven need to mvn clean & mvn package and then dump the war file into the tomcat webapp. 我的问题是,使用maven构建J2EE需要先mvn clean & mvn package ,然后将war文件转储到tomcat Webapp中。 Is there a more convenient way to achieve this like once I change the code, then the result will automatically show up when I access the ip of the container? 有没有更方便的方法来实现此目的,例如一旦更改代码,那么当我访问容器的ip时结果将自动显示?

You should use volume binding for what you want. 您应该将卷绑定用于所需的内容。 you can achieve it like this docker run -d -v $(pwd):/code-directory $(pwd) is your local directory. 您可以像这样docker run -d -v $(pwd):/code-directory $(pwd)是您的本地目录。

Take note: This is only recommended on local environment 注意:仅在本地环境中建议这样做

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM