Project

General

Profile

Actions

Task #2124

closed

Make CzechIdM image smaller

Added by Petr Fišer about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Petr Fišer
Target version:
Start date:
03/18/2020
Due date:
% Done:

100%

Estimated time:
Owner:

Description

The image is about 860MB large which is just awful.
Analyze and correct if it is possible.

(working with current develop bcv-czechidm:10.1.0-r1)

Actions #1

Updated by Petr Fišer about 4 years ago

Easiest to correct seem to be the 130MB increase in chown on layer 3203c39515aa . We do not use COPY --chown for portability reasons but using COPY and RUN chown in sequence makes overlay2 construct new layer with the same file. I think we do not need to do the chown at all because all we do with the WAR is that we read it (and by default it will have 644 permissions so we should be good).

[fiisch@dockerhost compose]$ docker history bcv-czechidm:10.1.0-r1 
IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
ea7c2dd939d1        5 days ago          /bin/sh -c #(nop)  EXPOSE 8080/tcp              0B                  
eaa3d53df8da        5 days ago          /bin/sh -c #(nop)  EXPOSE 8009/tcp              0B                  
621038271925        5 days ago          /bin/sh -c #(nop)  CMD ["/bin/bash" "-c" "$R…   0B                  
189601cac12f        5 days ago          /bin/sh -c mkdir -pv $CZECHIDM_CONFIG/{etc,l…   0B                  
ff199001b1a7        5 days ago          /bin/sh -c find "$RUNSCRIPTS_PATH/" -name "*…   24.9kB              
1d49e63e90c4        5 days ago          /bin/sh -c #(nop) COPY dir:ec3b0825e5e1549f5…   18.1kB              
3203c39515aa        5 days ago          /bin/sh -c chown -v idmbuild:idmbuild $CZECH…   131MB               
e4176022164c        5 days ago          /bin/sh -c #(nop) COPY multi:b7d45296ec4a911…   131MB               
68783e54363f        12 days ago         /bin/sh -c groupadd -r idmbuild &&   useradd…   21.1MB
...

Actions #2

Updated by Petr Fišer about 4 years ago

The chown really was unnecessary so I removed it. Image size fell from 860MB to 730MB. Tested, everything works fine.

[fiisch@dockerhost compose]$ docker history bcv-czechidm:10.1.0-r1 
IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
f2721be180fa        12 minutes ago      /bin/sh -c #(nop)  EXPOSE 8080/tcp              0B                  
ff010936c38a        12 minutes ago      /bin/sh -c #(nop)  EXPOSE 8009/tcp              0B                  
a6146217a320        12 minutes ago      /bin/sh -c #(nop)  CMD ["/bin/bash" "-c" "$R…   0B                  
157d32d597d4        12 minutes ago      /bin/sh -c mkdir -pv $CZECHIDM_CONFIG/{etc,l…   0B                  
03c29e818af1        12 minutes ago      /bin/sh -c find "$RUNSCRIPTS_PATH/" -name "*…   24.9kB              
fbb4bf7d38fc        12 minutes ago      /bin/sh -c #(nop) COPY dir:ec3b0825e5e1549f5…   18.1kB              
e4176022164c        5 days ago          /bin/sh -c #(nop) COPY multi:b7d45296ec4a911…   131MB               
68783e54363f        12 days ago         /bin/sh -c groupadd -r idmbuild &&   useradd…   21.1MB
...

Actions #3

Updated by Petr Fišer about 4 years ago

I was also looking at the tomcat image and the only place we could optimize is the yum exec on layer c3dc4b1326b0 .
But that layer contains yum update which we cannot drop for security/updates reason - so we are stuck there. I think this is the most we can do for now.

[fiisch@dockerhost compose]$ docker history bcv-tomcat:8.5.50-r0 
IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
699567389331        13 days ago         /bin/sh -c #(nop)  EXPOSE 8080/tcp              0B                  
7b79a6f79c0b        13 days ago         /bin/sh -c #(nop)  EXPOSE 8009/tcp              0B                  
f17865874572        13 days ago         /bin/sh -c #(nop)  CMD ["/bin/bash" "-c" "$R…   0B                  
0d8e9a760c4d        13 days ago         /bin/sh -c #(nop) COPY file:d2046bfbcc4c0d25…   2.96kB              
9bf3478e5cf7        13 days ago         /bin/sh -c find "$RUNSCRIPTS_PATH/" -name "*…   6.82kB              
f5f7831c8450        13 days ago         /bin/sh -c #(nop) COPY dir:42f9eacceff456f6a…   6.82kB              
5821460bcc39        13 days ago         /bin/sh -c groupadd -r -g 998 tomcat &&   us…   15MB                
7fe13d2f803b        13 days ago         /bin/sh -c mkdir -v /opt/tomcat &&   ddist()…   14.6MB              
c3dc4b1326b0        13 days ago         /bin/sh -c yum install -y epel-release &&   …   317MB               
8eb93b75eb58        13 days ago         /bin/sh -c #(nop)  ENV RUNSCRIPTS_PATH=/runs…   0B                  
6d9acab89c48        13 days ago         /bin/sh -c #(nop)  ENV TOMCAT_VERSION=8.5.50    0B                  
5f26c8f330b8        13 days ago         /bin/sh -c #(nop)  ENV TOMCAT_MAJOR=8           0B                  
5e35e350aded        4 months ago        /bin/sh -c #(nop)  CMD ["/bin/bash"]            0B                  
<missing>           4 months ago        /bin/sh -c #(nop)  LABEL org.label-schema.sc…   0B                  
<missing>           4 months ago        /bin/sh -c #(nop) ADD file:45a381049c52b5664…   203MB

Actions #4

Updated by Petr Fišer about 4 years ago

  • % Done changed from 0 to 100

Pushed onto develop in git.b09542e . Documentation not needed.
Waiting for official release.

Actions #5

Updated by Petr Fišer about 4 years ago

  • Status changed from In Progress to Resolved
Actions #6

Updated by Petr Fišer about 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF