Skip to content

Cannot squash if no "real" layers #33823

@ijc

Description

@ijc

Description

My first attempt to reproduce #33822 was with a Dockerfile which just contained a couple of ENV statements. But the docker build --squash failed with:

error squashing image: error getting tar stream to parent: layer ID 'sha256:404361ced64e208b54937071ef96722b59d45df96dea1652d655e961625ee5bd' is not a parent of the specified layer: cannot provide diff to non-parent

Steps to reproduce the issue:

# cat iidsquash/Dockerfile
FROM alpine:3.6
ENV FOO=BAR
ENV BAZ=BAH
# docker build  --squash iidsquash/
Sending build context to Docker daemon  3.072kB
Step 1/3 : FROM alpine:3.6
 ---> 665ffb03bfae
Step 2/3 : ENV FOO BAR
 ---> Using cache
 ---> 7320b5308144
Step 3/3 : ENV BAZ BAH
 ---> Using cache
 ---> 04519b303d0e
error squashing image: error getting tar stream to parent: layer ID 'sha256:404361ced64e208b54937071ef96722b59d45df96dea1652d655e961625ee5bd' is not a parent of the specified layer: cannot provide diff to non-parent

Describe the results you received:

The above error message, which is a little cryptic, especially since sha256:404361ced64e2... isn't once of the hashes in the preceding output.

Describe the results you expected:

Ideally a successful squash or at least a more informative message (e.g. "No layers to squash" if that is indeed the cause)

Additional information you deem important (e.g. issue happens only occasionally):

This was a dev tree at d311a3a, via make shell. I was running ./bundles/latest/binary-daemon/dockerd --log-level=debug --experimental

Output of docker version:

Client:
 Version:      unknown-version
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   unknown-commit
 Built:        unknown-buildtime
 OS/Arch:      linux/amd64

Server:
 Version:      17.06.0-dev
 API version:  1.31 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   d311a3a68
 Built:        Mon Jun 26 11:45:35 2017
 OS/Arch:      linux/amd64
 Experimental: true

Output of docker info:

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 7
Server Version: 17.06.0-dev
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 ipvlan 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: 3addd840653146c90a254301d6c3a663c7fd6429
runc version: 2d41c047c83e09a6d61d464906feb2a2f3c52aa4
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.0-3-amd64
Operating System: Debian GNU/Linux 8 (jessie) (containerized)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.53GiB
Name: e6f2dd6a12e5
ID: SMVL:I3Z2:JGZD:W7RB:L2Z7:FGWM:2N7A:IOYF:J6XR:RUX4:76JL:LI3N
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

Additional environment details (AWS, VirtualBox, physical, etc.):

/cc @tonistiigi

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/builderBuildkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.version/master

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions