1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
Commit graph

5 commits

Author SHA1 Message Date
Yong Tang
847564fa49 Clean up tmp files for interrupted docker build
This fix tries to fix the issue raised in 29486 where interrupted
`docker build` leaves some tmp files in `/var/lib/docker/tmp`.
With tmp file name prefixed with `/var/lib/docker/tmp/docker-builderXXXXXX`.

The reason for the issue is that in `MakeTarSumContext()`:
```
	if err := chrootarchive.Untar(sum, root, nil); err != nil {
		return nil, err
	}
```
the `err` is shadowed and caused the clean up function in `defer func()`
not being called.

This fix fixes the issue.

This fix is tested manually, as was specified in 29486:
```
rm -rf /var/lib/docker/tmp

mkdir repro && cd repro
fallocate -l 300M bigfile

cat > Dockerfile <<EOF
FROM scratch
COPY ./bigfile /
EOF

docker build .
{Cancel}

ls -la /var/lib/docker/tmp
```

This fix fixes 29486.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-12-16 21:11:53 -08:00
John Howard
4f3889e4be Windows: Fix builder cache bug
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-10-27 12:27:30 -07:00
Aaron Lehmann
8691a77e44 Fix build cache false positives when build context tar contains unnormalized paths
If a build context tar has path names of the form 'x/./y', they will be
stored in this unnormalized form internally by tarsum. When the builder
walks the untarred directory tree and queries hashes for each relative
path, it will query paths of the form 'x/y', and they will not be found.

To correct this, have tarsum normalize path names by calling Clean.

Add a test to detect this caching false positive.

Fixes #21715

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-04-14 17:57:45 -07:00
Tonis Tiigi
47da59f7ec Fix symlink handling in builder ADD/COPY commands
Fixes #17290

Fixes following issues:

- Cache checksums turning off while walking a broken symlink.

- Cache checksums were taken from symlinks while targets were actually copied.

- Copying a symlink pointing to a file to a directory used the basename of the target as a destination basename, instead of basename of the symlink.


Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2015-11-06 10:58:12 -08:00
Tibor Vass
e0ef11a4c2 Abstract builder and implement server-side dockerfile builder
This patch creates interfaces in builder/ for building Docker images.
It is a first step in a series of patches to remove the daemon
dependency on builder and later allow a client-side Dockerfile builder
as well as potential builder plugins.

It is needed because we cannot remove the /build API endpoint, so we
need to keep the server-side Dockerfile builder, but we also want to
reuse the same Dockerfile parser and evaluator for both server-side and
client-side.

builder/dockerfile/ and api/server/builder.go contain implementations
of those interfaces as a refactoring of the current code.

Signed-off-by: Tibor Vass <tibor@docker.com>
2015-10-06 19:10:19 -04:00