Current location - Health Preservation Learning Network - Healthy weight loss - Why is the mysql image I created on docker so big?
Why is the mysql image I created on docker so big?
In the process of making mirror images, we should pay attention to the following points:

The 1. file system is UnionFs, and each run in Dockerfile will generate a layer. So we need to clean up the generated data after each run. Because the generated result (the size of 3G) is a linear superposition of all levels.

2. Why are official images generally small? Let's take mysql:5.6 as a reference to analyze:

Run apt-get update & apt-get install-yperl-no-install-recommended &; & rm-rf/var/lib/apt/lists/* After updating the build, the cache package file of apt is deleted. Generally speaking, this folder will occupy about 100M depending on the situation.

Run {... & apt-get update. & apt-get installation -y

MYSQL-server = " $ { MYSQL _ VERSION } " & amp; & ampRM-RF/var/lib/apt/lists/* & amp; & amp space

-RF/var/lib/MySQL & amp; & mkdir-p/var/lib/MySQL deletes cached package files as usual after installing db. Deleting /var/lib/mysql can clear the sample database.

Let's look at the most commonly used vim package in hub.docker.com, and we find that the haron/vim image is the basic image for 300M.

After a rough search on hub.docker.com, I didn't find mysql pictures based on centos. Personal estimation is that the cached package has not been deleted, which leads to problems.

As for the basic image size mentioned by @ ShawnTaoo, I also made a survey: Centos: latest 190+MB, Debian: Jessie: 130+MB, Ubuntu: latest 180+MB.