Ask questionsfailed to export image: failed to create image: failed to get layer: layer does not exist

<!-- If you are reporting a new issue, make sure that we do not have any duplicates already open. You can ensure this by searching the issue list for this repository. If there is a duplicate, please close your issue and add a comment to the existing issue instead.

If you suspect your issue is a bug, please edit your issue description to include the BUG REPORT INFORMATION shown below. If you fail to provide this information within 7 days, we cannot debug your issue and will close it. We will, however, reopen it if you later provide the information.

For more information about reporting issues, see


The GitHub issue tracker is for bug reports and feature requests. General support for docker can be found at the following locations:

  • Docker Support Forums -
  • Slack - #general channel
  • Post a question on StackOverflow, using the Docker tag

General support for moby can be found at the following locations:

  • Moby Project Forums -
  • Slack - #moby-project channel
  • Post a question on StackOverflow, using the Moby tag


Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST -->


  • Docker CE 18.02
  • Linux 4.15.7-1-ARCH #1 SMP PREEMPT Wed Feb 28 19:01:57 UTC 2018 x86_64 GNU/Linux
  • BTRFS as filesystem
  • Docker uses subvolumes

Sometimes when building my images i have this error.

As docker uses subvolumes, i know that sometimes BTRFS just wreck everything and files/subvolumes aren't visible from "users", including "ls" in a shell or, here, Docker.

The problem appears after many build happened. Also, the cache isn't available for docker to use it. When issuing sudo sync, the docker cache is available and build can continue from where it stopped.

Steps to reproduce the issue:

  1. BTRFS as main filesystem, docker to use subvolumes
  2. Multistage Build build build build build build build build build… many times until it happens. Having big layers helps.
  3. When the error show up, try to resume the build: cache isn't used.
  4. Issue sync as root, wait for the command to finish
  5. Restart the build: cache is available and build resumes

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

Output of docker version:

❭ docker version
 Version:       18.02.0-ce
 API version:   1.36
 Go version:    go1.9.4
 Git commit:    fc4de447b5
 Built: Tue Feb 13 15:28:01 2018
 OS/Arch:       linux/amd64
 Experimental:  false
 Orchestrator:  swarm

  Version:      18.02.0-ce
  API version:  1.36 (minimum version 1.12)
  Go version:   go1.9.4
  Git commit:   fc4de447b5
  Built:        Tue Feb 13 15:28:34 2018
  OS/Arch:      linux/amd64
  Experimental: false

Output of docker info:

Containers: 673
 Running: 1
 Paused: 0
 Stopped: 672
Images: 1805
Server Version: 18.02.0-ce
Storage Driver: btrfs
 Build Version: Btrfs v4.15
 Library Version: 102
Logging Driver: json-file
Cgroup Driver: cgroupfs
 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: 9b55aab90508bd389d7654c4baf173a981477d55
runc version: 9f9c96235cc97674e935002fc3d78361b696a69e
init version: 949e6fa
Security Options:
  Profile: default
Kernel Version: 4.15.7-1-ARCH
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.643GiB
Name: padme
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: leryan
Experimental: false
Insecure Registries:
Live Restore Enabled: false

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

Physical with SSD.


Answer questions fractos

Removing report - this is for BTRFS. Sorry.

Related questions

start container failed with "failed to umount /var/lib/docker/containers/.../shm: no such file or directory" hot 65
start container failed with "failed to umount /var/lib/docker/containers/.../shm: no such file or directory" hot 29
upgrade docker-18.09.2-ce , shim.sock: bind: address already in use: unknown hot 27
runc regression - EPERM running containers from selinux hot 16
Windows Server 2019 publish ports in swarm not working hot 14
Error response from daemon: rpc error: code = DeadlineExceeded desc = context deadline exceeded hot 13
"docker stack deploy">"rpc error: code = 3 desc = name must be valid as a DNS name component" hot 12
Swarm restarts all containers hot 10
integration: "error reading the kernel parameter" errors during CI hot 10
write unix /var/run/docker.sock->@: write: broken pipe hot 10
hcsshim::PrepareLayer failed in Win32: The parameter is incorrect hot 10
OCI runtime exec failed: exec failed: cannot exec a container that has stopped: unknown hot 9
Docker 18.09.1 doesn't work with iptables v1.8.2 hot 9
dockerd stopped responding to API requests; no installed keys could decrypt message hot 9
manifest invalid error when pushing image to hot 8
Github User Rank List