Java – docker creates huge image sizes
I pull the base Ubuntu: the latest image (192.7 MB in size), only Oracle java7 (JDK) (tar.gz ~ 53MB in size) is installed, and the generated image is submitted The image size is 903mb
Why is there so much room for image size to increase? We also need to add other components (Tom, cat, vertx, mysql, etc.) The image size will become difficult to control
Any tips on how to reduce the image size?
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE gammay/baseimage v0.1a 80324b762c5e 21 minutes ago 903.6 MB ubuntu latest 9bd07e480c5b 2 weeks ago 192.7 MB
Solution
what time?
>This dockerfile will build a tiny Oracle JDK image Also read the accounting blog post. > You may not need to run the JDK of the container. You can use the container based on JRE You can use a separate compiler container at any time to create jars to enter the application container. > If you can, consider using the official JAVA images created on openjdk, which are quite small. > Ideally, you should put separate processes (such as MySQL) in separate containers