docker / for-linux

Docker Engine for Linux
https://docs.docker.com/engine/installation/
757 stars 86 forks source link

Docker diff not working #307

Open marc1uk opened 6 years ago

marc1uk commented 6 years ago

Expected behavior

docker diff will show history of layers and their changes

Actual behavior

docker diff prints a stat error from the daemon: Error response from daemon: stat /var/lib/docker/overlay2/9daff4cb70ea36ecfef43d41bd02bc829ec9fac93da01e5787b3fee68a9d810e/diff/var/cache/yum/x86_64: not a directory

Steps to reproduce the behavior

Make a docker image Make some changes Run docker diff ${imagename}

Output of docker version:

Client:
 Version:   18.03.0-ce
 API version:   1.37
 Go version:    go1.9.4
 Git commit:    0520e24
 Built: Wed Mar 21 23:10:06 2018
 OS/Arch:   linux/amd64
 Experimental:  false
 Orchestrator:  swarm

Server:
 Engine:
  Version:  18.03.0-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.4
  Git commit:   0520e24
  Built:    Wed Mar 21 23:08:35 2018
  OS/Arch:  linux/amd64
  Experimental: false

Output of docker info:

Containers: 1
 Running: 0
 Paused: 0
 Stopped: 1
Images: 5
Server Version: 18.03.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: cfd04396dc68220d1cecbe686a6cc3aa5ce3667c
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.0-4-amd64
Operating System: Debian GNU/Linux 9 (stretch)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.756GiB
Name: minihal
ID: DAHH:XPFO:W4BM:HFFS:3P2R:GC4O:4TNA:HN5V:M6UN:EAXU:SL3R:XOXF
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.) standard physical machine.

marc1uk commented 6 years ago

see also: https://github.com/docker/for-win/issues/1320 see also: https://github.com/docker/for-mac/issues/1785

ncouse commented 6 years ago

I also experienced this, and also was a problem under /var/cache/yum, for a centos based container.

I removed the file inside the container, and tried again, but got an error about a different file. I eventually removed all of /var/cache/yum, and then the diff worked for me.

Note that there had been a lot of activity within the container, and obviously yum was used to install some extra packages at runtime.

I only encountered it (so far) on this one container instance.

Note: I am running 18.05.0-ce on a Ubuntu 16.04 host using overlay2 storage driver.

Yang-Wei-Ting commented 2 years ago

In my case, upgrading cpp, gcc, libgcc, libgomp always breaks docker diff.

[user@dev ~]$ docker exec -it ee0ad6f6b0ba bash

[root@ee0ad6f6b0ba /]# uname -a
Linux ee0ad6f6b0ba 5.3.15-200.fc30.x86_64 #1 SMP Thu Dec 5 15:18:00 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

[root@ee0ad6f6b0ba /]# dnf upgrade libgomp
Last metadata expiration check: 0:03:34 ago on Fri 11 Feb 2022 02:05:40 AM UTC.
Dependencies resolved.
==================================================================================================================================================================================
 Package                                  Architecture                            Version                                        Repository                                  Size
==================================================================================================================================================================================
Upgrading:
 cpp                                      x86_64                                  8.5.0-4.el8_5                                  appstream                                   10 M
 gcc                                      x86_64                                  8.5.0-4.el8_5                                  appstream                                   23 M
 libgcc                                   x86_64                                  8.5.0-4.el8_5                                  baseos                                      79 k
 libgomp                                  x86_64                                  8.5.0-4.el8_5                                  baseos                                     206 k

Transaction Summary
==================================================================================================================================================================================
Upgrade  4 Packages

Total download size: 34 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): libgcc-8.5.0-4.el8_5.x86_64.rpm                                                                                                             65 kB/s |  79 kB     00:01
(2/4): libgomp-8.5.0-4.el8_5.x86_64.rpm                                                                                                           462 kB/s | 206 kB     00:00
(3/4): cpp-8.5.0-4.el8_5.x86_64.rpm                                                                                                               1.2 MB/s |  10 MB     00:09
(4/4): gcc-8.5.0-4.el8_5.x86_64.rpm                                                                                                               1.4 MB/s |  23 MB     00:17
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                             2.0 MB/s |  34 MB     00:17
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                          1/1
  Upgrading        : libgomp-8.5.0-4.el8_5.x86_64                                                                                                                             1/8
  Running scriptlet: libgomp-8.5.0-4.el8_5.x86_64                                                                                                                             1/8
  Upgrading        : libgcc-8.5.0-4.el8_5.x86_64                                                                                                                              2/8
  Running scriptlet: libgcc-8.5.0-4.el8_5.x86_64                                                                                                                              2/8
  Upgrading        : cpp-8.5.0-4.el8_5.x86_64                                                                                                                                 3/8
  Running scriptlet: cpp-8.5.0-4.el8_5.x86_64                                                                                                                                 3/8
  Upgrading        : gcc-8.5.0-4.el8_5.x86_64                                                                                                                                 4/8
  Running scriptlet: gcc-8.5.0-4.el8_5.x86_64                                                                                                                                 4/8
  Running scriptlet: gcc-8.4.1-1.el8.x86_64                                                                                                                                   5/8
  Cleanup          : gcc-8.4.1-1.el8.x86_64                                                                                                                                   5/8
  Running scriptlet: cpp-8.4.1-1.el8.x86_64                                                                                                                                   6/8
  Cleanup          : cpp-8.4.1-1.el8.x86_64                                                                                                                                   6/8
  Cleanup          : libgcc-8.4.1-1.el8.x86_64                                                                                                                                7/8
  Running scriptlet: libgcc-8.4.1-1.el8.x86_64                                                                                                                                7/8
  Running scriptlet: libgomp-8.4.1-1.el8.x86_64                                                                                                                               8/8
  Cleanup          : libgomp-8.4.1-1.el8.x86_64                                                                                                                               8/8
  Running scriptlet: libgomp-8.4.1-1.el8.x86_64                                                                                                                               8/8
  Verifying        : cpp-8.5.0-4.el8_5.x86_64                                                                                                                                 1/8
  Verifying        : cpp-8.4.1-1.el8.x86_64                                                                                                                                   2/8
  Verifying        : gcc-8.5.0-4.el8_5.x86_64                                                                                                                                 3/8
  Verifying        : gcc-8.4.1-1.el8.x86_64                                                                                                                                   4/8
  Verifying        : libgcc-8.5.0-4.el8_5.x86_64                                                                                                                              5/8
  Verifying        : libgcc-8.4.1-1.el8.x86_64                                                                                                                                6/8
  Verifying        : libgomp-8.5.0-4.el8_5.x86_64                                                                                                                             7/8
  Verifying        : libgomp-8.4.1-1.el8.x86_64                                                                                                                               8/8

Upgraded:
  cpp-8.5.0-4.el8_5.x86_64                  gcc-8.5.0-4.el8_5.x86_64                  libgcc-8.5.0-4.el8_5.x86_64                  libgomp-8.5.0-4.el8_5.x86_64

Complete!

[root@ee0ad6f6b0ba /]# exit
exit

docker diff shows not a directory error

[user@dev ~]$ docker diff ee0ad6f6b0ba
Error response from daemon: stat /mnt/data/docker/overlay2/2e1a7d62552651c9dd9435ea96a44431c4645a22c1e8177659f16056c147cc94/diff/usr/lib/.build-id/f4/ab03961fed72ed3181a4bec36cc3d22c3cf16a: not a directory