Docker Community Forums

Share and learn in the Docker community.

Docker image size

docker

(Tpasenthill) #1

Sample dockerfile
FROM ubuntu
RUN mkdir -p /tmp
ADD jdk1.8_152/ /tmp/jdk1.8_152/
ADD <<service-name.jar>> /tmp/service-name.jar
CMD jdk1.8_152/bin/ java -jar service-name.jar

We have the above steps in our docker file to build the images. The size of the final image becomes very large
NodeJS 1.35 GB
Python 3.1 GB
Java service - 1 GB

Is there any way to reduce the image size. As per the principles, the image / container should be lightweight in nature. What is the best practice to be followed. Pls suggest