mirror of https://github.com/docker/cli.git
image build: fix archive detection
As pointed out in #1459, docker cli fails to detect that the input is a tarball, in case it is generated by `git archive --format=tgz`. This happens because `git archive` adds some metadata to the initial tar header, and so it is more than 1 block (of 512 bytes) long, while we only provide 1 block to archive/tar.Next() and it fails. To fix, give it 2 blocks :) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
parent
984ad2f075
commit
0c20554f69
|
@ -89,7 +89,7 @@ func ValidateContextDirectory(srcPath string, excludes []string) error {
|
|||
func DetectArchiveReader(input io.ReadCloser) (rc io.ReadCloser, isArchive bool, err error) {
|
||||
buf := bufio.NewReader(input)
|
||||
|
||||
magic, err := buf.Peek(archiveHeaderSize)
|
||||
magic, err := buf.Peek(archiveHeaderSize * 2)
|
||||
if err != nil && err != io.EOF {
|
||||
return nil, false, errors.Errorf("failed to peek context header from STDIN: %v", err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue