Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot squash if no "real" layers #33823

Open
ijc opened this issue Jun 26, 2017 · 7 comments
Open

Cannot squash if no "real" layers #33823

ijc opened this issue Jun 26, 2017 · 7 comments
Labels
area/builder kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. version/master

Comments

@ijc
Copy link
Contributor

ijc commented Jun 26, 2017

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

@vdemeester
Copy link
Member

cc @tonistiigi @cpuguy83

@cpuguy83
Copy link
Member

The squash function is pretty generic and does not have any logic of the build. I think the builder would need to track if a squash is necessary in this case.

@thaJeztah
Copy link
Member

@ijc do you think we should close this one, given the plans to deprecate/remove --squash? (see #34565)

@thaJeztah thaJeztah added the kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. label Oct 24, 2017
@ijc
Copy link
Contributor Author

ijc commented Oct 24, 2017

I think this can be closed when we remove --squash, yes. If --squash doesn't end up getting removed for some reason (and people do seem to be providing arguments for keeping it in that issue, so we probably shouldn't preempt the outcome just yet) then obviously this one should stay.

@thaJeztah
Copy link
Member

I opened a PR for documenting this limitation; docker/cli#639

and people do seem to be providing arguments for keeping it in that issue

I think we should enhance the COPY --from feature to address that issue; I can open a proposal for that.

@thaJeztah
Copy link
Member

(update: opened #35280 as a proposal to address the "squash" use case)

@OP-9527
Copy link

OP-9527 commented Feb 1, 2019

I have the same issue when docker build with --squash,weird , another project build with this parameter are success.
Who can tell me what causes it and how to solve it?

Removing intermediate container d909512ed3dd
 ---> 4992165f13ec
error squashing image: error getting tar stream to parent: layer ID 'sha256:73f83ee643709fdb437ddcf754d08bf0018d023125affc001063f5c3d24aa933' is not a parent of the specified layer: cannot provide diff to non-parent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/builder kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. version/master
Projects
None yet
Development

No branches or pull requests

6 participants