简体   繁体   中英

Docker debug a large image layer

I am building a docker file and noticed one of the layers (while pushing) is over 1GB.

How can I debug what files exist in a specific layer to find the offending file which I need to add to .dockerignore ?

I think this tool could be helpful https://github.com/wagoodman/dive It allows you to inspect each layer.

You can run the tool also inside docker, mounting the docker sock, if you prefer not to install it.

Example to inspect ubuntu:20.04 image layers and contents:

 docker run --rm -it \
    -v /var/run/docker.sock:/var/run/docker.sock \
    wagoodman/dive:latest ubuntu:20.04

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM