Why the docker itself to create the mysql mirror particularly large

The novice is just getting started and learning to create a mirror image of the system and a variety of applications

I first produced a centos67 mirror, and then based on centos67 installed vim, then docker commit saved as centos67vim
And then based on centos67vim compiler installed mysql5.6 and then commit to save mysql56, but found that capacity reached 1.591GB

I then docker pull mysql found why the official offer only 360.3

Thank you greatly for help! The

5 Solutions collect form web for “Why the docker itself to create the mysql mirror particularly large”

In the process of making a mirror, we have to pay attention to several points:
1. File system is UnionFs, Dockerfile in each RUN will generate a layer (layer). So we need to clean up the resulting data after each RUN. Because the resulting result (the size of the 3G) is a linear superposition of the size of each hierarchy.
2. Why is the official image of the general small it? We have to mysql: 5.6 as a reference, to analyze:

RUN apt-get update && apt-get install -y perl –no-install-recommends && rm -rf / var / lib / apt / lists / *
After the update is set up, then remove the apt cache package file. Usually this folder will take about 100M depending on the situation.

RUN {… && apt-get update && apt-get install -y
Mysql-server = "$ {MYSQL_VERSION}" && rm -rf / var / lib / apt / lists / * && rm
-rf / var / lib / mysql && mkdir-p / var / lib / mysql After installing db, delete the cached package file as usual. Remove / var / lib / mysql to clear the sample database.

And we look at the hub.docker.com most commonly used vim package, we found haron / vim mirror is 300M used as the basis of the mirror image.

Found in the hub.docker.com rough, did not find the basis of centql mysql mirror. Personal estimates are cached packages that are not deleted, causing problems.

As for the @ShawnTaoo brothers mentioned the basic mirror size problem, I also made the next survey: centos: latest 190 + MB, debian: jessie: 130 + MB, ubuntu: latest 180 + MB


Reference:

  1. Mysql image analysis

  2. Haron / vim analysis

  3. Centos Fundamental Mirror Analysis

  4. Ubuntu basic mirror analysis

No wonder I installed a lamp installation package on the 3G, the original increase in a mysql 1G

Not ready to read the introductory tutorial and then play

Did not delete the temporary file to commit

You can look at the official image of the mysql dockerfile, the basic mirror should also be estimated it different Under normal circumstances, many of the official base mirror is very small. Such as scratch , but if you use a ubuntu what, you have about 180M (thanks @
Imdjh correct), centos I did not notice.

If you can put your Dockerfile open out, we can help you see. Mainly or Dockerfile writing problem

Heads up! This alert needs your attention, but it's not super important.