Docker分层垃圾清理

由于Docker的文件系统是分层结构,所以过去分层中的垃圾会一直占用空间,使得镜像变得臃肿。对于各层产生的垃圾,一定要就地完成清理。

apt-get 产生的垃圾

RUN apt-get update \
    && apt install xxx \
    && ... \
    && apt-get autoclean [Warning] IPv4 forwarding is disabled. Networking will not work.\
    && rm -rf /var/lib/apt/lists/*

Last updated

Was this helpful?