docker-images icon indicating copy to clipboard operation
docker-images copied to clipboard

Docker Image Size is almost 3GB using the provided Dockerfile

Open chayzgithub opened this issue 8 years ago • 11 comments

Hello,

I have a RHEL base image (200 MB) on which I have build the Server JRE image (added 150 MB) and then build on the top-the Weblogic Server Image 12.2.1.3 using the provided Docker file. This is resulting in a final image that is almost 3 gb (2.89 GB to be precise).

However, when I download the Oracle provided WLS 12.2.1.3 using the below command, it is only 1.14 GB. docker pull store/oracle/weblogic:12.2.1.3

Is the docker file not Size friendly /Multi-Staged? Please help. I will really appreciate it.

Thank you Chay

chayzgithub avatar Dec 03 '18 16:12 chayzgithub

The WebLogic 12.2.1.3 image is built using the same Dockerfile but using the Oracle Linux slim and the Server JRE image. Could you do a docker history and let me know the size of RH and JDK layers? Also what WebLogic installer are you using? I believe you can do a Docker squash to make the image size smaller. Monica

mriccell avatar Dec 03 '18 23:12 mriccell

Hello Monica,

I am following the instructions from 12.2.1.3 (generic) from the below URL for server JRE ( only changed first line in dockerfile to extend RHEL base image) and Weblogic Server.

https://github.com/oracle/docker-images/tree/master/OracleWebLogic/dockerfiles/12.2.1.3

I made one change since then that reduced the size from 2.89 GB to 2.05 GB.

COPY $FMW_PKG install.file oraInst.loc /u01/ RUN chown oracle:oracle -R /u01 to: RUN chown oracle:oracle -R /u01 COPY --chown oracle:oracle $FMW_PKG install.file oraInst.loc /u01/

However it is still over 2 GB.

I see from the history that RHEL is about 201 MB, JRE is about 152MB. But I see 839MB and 863MB added due to COPY --chown=oracle:oracle.. and cd /u01 && $JAVA_HOME/bin/jar xf … Statements in the docker file that is causing the image to bloat up.

Here is the history output

IMAGE CREATED CREATED BY SIZE COMMENT 4af03af2cc8d 17 seconds ago /bin/sh -c #(nop) CMD ["/u01/oracle/createA… 0B
9c13c7580447 17 seconds ago /bin/sh -c #(nop) WORKDIR /u01/oracle 0B

4a1a3bfad025 18 seconds ago /bin/sh -c cd /u01 && $JAVA_HOME/bin/jar xf … 863MB****
9dbe2a1084ac About a minute ago /bin/sh -c #(nop) USER oracle 0B
b07610202ce9 About a minute ago /bin/sh -c #(nop) COPY --chown=oracle:oracle 839MB
f542ee13d47b 2 minutes ago /bin/sh -c chown oracle:oracle -R /u01 && ch… 6kB
296b4d56b3d6 2 minutes ago /bin/sh -c #(nop) ENV FMW_PKG=fmw_12.2.1.3.… 0B
2d82303b4b0b 2 minutes ago /bin/sh -c #(nop) ENV DOMAIN_NAME=base_doma… 0B
bd11a8273205 2 minutes ago /bin/sh -c #(nop) COPY multi:7b1613647941238… 5.56kB
19880cda1498 2 minutes ago /bin/sh -c mkdir -p /u01 && chmod a+xr /… 296kB
ec83bbe0e530 2 minutes ago /bin/sh -c #(nop) ENV ORACLE_HOME=/u01/orac… 0B
9dad74677ab9 11 hours ago /bin/sh -c export JAVA_DIR=$(ls -1 -d /usr/j… 377B
95a5856ac5c0 11 hours ago /bin/sh -c #(nop) ADD file:f27f617b87b35c9a1… 152MB
dc01ae8f5f92 11 hours ago /bin/sh -c #(nop) ENV JAVA_PKG=server-jre-8… 0B
dfb5dc8ad64f 11 hours ago /bin/sh -c #(nop) MAINTAINER Chay Teegavara… 0B
7b875638cfd8 2 months ago 2.9kB
2 months ago 201MB Imported from -

chayzgithub avatar Dec 04 '18 02:12 chayzgithub

The Oracle Linux layer is 117MB and the Server JRE is about 162MB the 863 comes from the actual installation of the WebLogic binaries. The problem is the 839 in the bin/sh -c #(nop) COPY --chown=oracle:oracle 839MB. Let me look into this.

mriccell avatar Dec 04 '18 04:12 mriccell

Sure, Thank you in advance!!

chayzgithub avatar Dec 04 '18 04:12 chayzgithub

In the Dockerfile you can add "--squash" to the docker build command line to reduce the size.

shean-guangchang avatar Dec 05 '18 19:12 shean-guangchang

Squash did help to compress the file considerably- Thank you. Any issues with it being considered an experimental feature?

I am still waiting on Monica's response on the docker file issue (COPY command) as it could reduce the size further.

chayzgithub avatar Dec 07 '18 00:12 chayzgithub

The Oracle Linux layer is 117MB and the Server JRE is about 162MB the 863 comes from the actual installation of the WebLogic binaries. The problem is the 839 in the bin/sh -c #(nop) COPY --chown=oracle:oracle 839MB. Let me look into this.

Hi Monica,

Were you able to figure this out? Please let me know.

Thank you. Chay

chayzgithub avatar Dec 11 '18 17:12 chayzgithub

I'm having a problem logging into Oracle to download the 12213-patch. I get an error page when clicking on the downloads link. I've registered but when I login it seems I have to go through some procress and I'm just stuck on that page - no links are clickable - just nothing happens - is there any other alternate way to get download the 12213-patch?

We need to connect your user account to a Support Identifier. Access and privileges are approved by an Administrator in your organization. You need to add at least one Support Identifier to proceed.

I'm not sure how to proceed from here!

mommaroodles avatar Jan 08 '19 17:01 mommaroodles

@mommaroodles To download patches for WebLogic from support.oracle.com you must use My Oracle Support credentials. Thanks Monica

mriccell avatar Jan 08 '19 17:01 mriccell

thank you !

mommaroodles avatar Jan 08 '19 17:01 mommaroodles

Squash did help to compress the file considerably- Thank you. Any issues with it being considered an experimental feature?

I am still waiting on Monica's response on the docker file issue (COPY command) as it could reduce the size further.

Hi Monica,

Just Coming back from Holidays. I wanted to find out, has any work being done towards the issue I raised for the COPY command?

Thanks Chad

chayzgithub avatar Jan 09 '19 14:01 chayzgithub