title: How to reduce docker image size for CentOS 7?
body: <p>I have recently started working on docker and I am trying to build a custom image for CentOS using CentOS:7.5.1804 image.</p>
  
  <p>The problem I am facing here is that the original CentOS:7.5.1804 image is showing size 200MB and after I add the desired packages, the size of image becomes 1.2 GB! I am trying to figure out if there is a way to reduce the image size?</p>
  
  <p>I tried using <code>yum clean all</code> &amp; <code>rm -rf /var/cache/yum</code> in my dockerfile, however it barely reduced few MBs and it didn't helped much.</p>
  
  <p>Any inputs/suggestions/best practices to reduce image size are welcome. My docker file is as shown below, which results into a 1.2GB image!</p>
  
  <pre><code>#Use CentOS as base
  FROM centos:7.5.1804
  
  # Docker recommends
  RUN yum -y update &amp;&amp; yum clean all
  
  # Install custom tools
  RUN yum -y install openssl &amp;&amp; yum install -y nc &amp;&amp; \
  yum -y install python3 &amp;&amp; pip3 install j2cli &amp;&amp; \
  yum -y install epel-release &amp;&amp;  yum -y update &amp;&amp; yum install -y ccrypt &amp;&amp; \
  yum clean all &amp;&amp; rm -rf /var/cache/yum
  </code></pre>