Docker: Which approach is better? WAR embedded in image or base image + war?
Just started playing around with Docker. To deploy a war on tomcat there seem to be two approaches:
Approach 1:
Approach 2:
Which of these approaches is typically used in production?
If you want to deploy your code onto a docker orchestration service such as Google Container Engine, Amazon Container Service etc then option 1 is normally the only feasible solution as you don't have access to the host. Option 1 is also more scalable on docker orchestration systems as you can create multiple instances of your service on various docker hosts.
However, I myself use option 2 for the reasons you have mentioned and because I manage scaling through auto-scaling groups using cloud formation which can provision instances with my war in the local store. Right now I don't think docker orchestration is mature enough for me to replace my external orchestration systems and if I have those systems setup then there is no point loosing the benefits of approach 2. However, when amazon allows us to connect ELBs directly to docker containers and makes a few more improvements I will seriously reconsider.
Due to the large image sizes, maintaining one image for each build and sharing the image for downstream deployment could become an issue
FYI Docker uses a diff based file system so as long as you are only changing the war file your image storage should not be an issue.
链接地址: http://www.djcxy.com/p/24086.html