Docker diff 命令

发布于 2022-07-17 23:17:17 更新于 2022-07-17 23:17:17

用法

Usage: docker diff [OPTIONS] CONTAINER

Inspect changes on a container's filesystem

  --help=false       Print usage

作用

diff 可以列出 3 种容器内文件状态变化(A - Add, D - Delete, C - Change )的列表清单。它是构建镜像过程中需要的调试指令。

例子

~ docker ps
CONTAINER ID   IMAGE          COMMAND                  CREATED      STATUS         PORTS                NAMES
7176225f191d   nginx:1.19.4   "/docker-entrypoint.…"   8 days ago   Up 2 seconds   0.0.0.0:80->80/tcp   nginx
~ docker diff 7176225f191d
C /var
C /var/cache
C /var/cache/nginx
A /var/cache/nginx/proxy_temp
A /var/cache/nginx/scgi_temp
A /var/cache/nginx/uwsgi_temp
A /var/cache/nginx/client_temp
A /var/cache/nginx/fastcgi_temp
C /run
A /run/nginx.pid
C /etc
C /etc/nginx
C /etc/nginx/conf.d
C /etc/nginx/conf.d/default.conf