我在使用docker
构建LNMP
环境时,我用docker
获取了centos
的镜像,然后在centos
里构建LNMP
的环境,我安装完mysql
之后进行了一次commit
,完成之后镜像大小时282M
,然后我又重新进入yum install了php
,完成之后commit
了一下,镜像大小就变为了659M
,为什么会这样,增长为什么会这么大?
PHPz2017-04-27 09:04:07
When installing a program through yum, many temporary files will be generated, and many software packages that are not necessarily needed will be installed as recommended software, so the image will naturally become larger.
In addition, it is best not to run all programs in one container, but to build services through container orchestration.
世界只因有你2017-04-27 09:04:07
You are using the docker container as a virtual machine. This is incorrect usage. You should use Dockerfile to make the image and follow the best principles for writing Dockerfile.
For lnmp’s Docker container production, please refer to https://www.centos.bz/2017/02...
曾经蜡笔没有小新2017-04-27 09:04:07
You made the image based on the centos system image, which is equivalent to bundling several images together, so it becomes larger. One program has one image, and then communicates, so it will not be too big.