Commit Graph

48 Commits

Author SHA1 Message Date
8391dba9e0 Merge pull request #11099 from iavael/bugfix/tar-symlinks
Fixed handling hardlinks to symlinks in tar stream
Upstream-commit: 88b8fc10e3dc5613859da31900e0a1b0bbb303c6
Component: engine
2015-04-01 18:34:00 -04:00
e5b36a723c Replace aliased imports of logrus, fixes #11762
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: 6f4d847046cb4e072de61d042c0266190d73a8c9
Component: engine
2015-03-26 23:22:04 +01:00
4ab99c503e Changing bitflag checking style to preferred style. Fixes #11668
Signed-off-by: Jimmy Puckett <jimmy.puckett@spinen.com>
Upstream-commit: ec5e22efe3fb88f2fa2eb5e9a37161940f86bcfa
Component: engine
2015-03-24 21:09:25 -04:00
c1aef62402 Merge pull request #11422 from vbatts/vbatts-overlay_dir_mtime_changes
pkg/archive: ignore mtime changes on directories
Upstream-commit: 9d00d8137f9b6075284a89bb832c4a828e19a9fb
Component: engine
2015-03-23 15:24:05 -07:00
62b8050640 Change windows default permissions to 755 not 711, read access for all poses little security risk and prevents breaking existing Dockerfiles
Signed-off-by: Mitch Capper <mitch.capper@gmail.com>
Upstream-commit: b7dc9040f04fe8dacd2f14c6b93d1b0bb6bde333
Component: engine
2015-03-20 21:54:33 -07:00
892ed3cf26 pkg/archive: ignore mtime changes on directories
on overlay fs, the mtime of directories changes in a container where new
files are added in an upper layer (e.g. '/etc'). This flags the
directory as a change where there was none.

Closes #9874

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 2ce37f6616762900aa941c0644dece9cdbf90124
Component: engine
2015-03-17 10:53:34 -04:00
b06c1f22f7 Make utils_daemon and volumes cross-platform compileable.
Signed-off-by: Rik Nijessen <riknijessen@gmail.com>
Upstream-commit: 1ec2eac50db2c98e00a488664625a22bf3757066
Component: engine
2015-03-16 11:46:07 +01:00
5506a9a27c Remove subdirectories MAINTAINERS files
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: 89bdaa35e04b74b7c6528783e0f7b8154b2a3d31
Component: engine
2015-03-06 18:21:51 -08:00
a0c6b78604 Merge pull request #11148 from ahmetalpbalkan/win-cli/chmod-x-fix
pkg/archive: adjust chmod bits on windows
Upstream-commit: a6ddb8de42c731ae8f9e0e1becc2a93a56158a58
Component: engine
2015-03-06 12:28:58 -05:00
15e04c816c pkg/archive_windows: make use of os.PathSeparator
cc: @jhowardmsft

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
Upstream-commit: 8ba64b383dee8827c70f9c0a0d71aa61d0f0c595
Component: engine
2015-03-05 17:15:11 -08:00
71919ac23a pkg/archive: adjust chmod bits on windows
This change modifies the chmod bits of build context archives built on
windows to preserve the execute bit and remove the r/w bits from
grp/others.

Also adjusted integ-cli tests to verify permissions based on the platform
the tests are running.

Fixes #11047.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
Upstream-commit: 1a22418f9f1573ca8521831d52c8e0562cb3ef8f
Component: engine
2015-03-04 14:10:37 -08:00
e76b08f45b pkg/archive: rm invalid test case from achive_windows_test.go
Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
Upstream-commit: baebff38d5f5d1cdecbc2544e22a42acf82bbf93
Component: engine
2015-03-03 18:42:52 -08:00
0a6bee6ece Fixed handling hardlinks to symlinks in tar stream
Signed-off-by: Iavael <iavaelooeyt@gmail.com>
Upstream-commit: ab181ce55707de6f47d662dcdf6eab9c6c040906
Component: engine
2015-03-03 16:10:53 +03:00
bdccc883c1 Support windows style dockerfile paths for build cmd
Currently TestBuildRenamedDockerfile fails since passing
custom dockerfile paths like:

    docker build -f dir/file .

fails on windows because those are unix paths. Instead, on
windows accept windows style paths like:

    docker build -f dir\file .

and convert them to unix style paths using the helper we
have in `pkg/archive` so that daemon can correctly locate
the path in the context.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
Upstream-commit: 5ecab9e831c6d39e649430013087a3e2a85fb949
Component: engine
2015-02-24 20:23:53 -08:00
4ab4d22713 Merge pull request #10865 from ahmetalpbalkan/win-cli/tar-path
pkg/archive: Canonicalize stored paths
Upstream-commit: 1d382f9c2d368adfea5b12316e3836ec82bd8d81
Component: engine
2015-02-20 17:20:51 -08:00
b5e8758d2a pkg/archive: Canonicalize stored paths
Currently pkg/archive stores nested windows files with
backslashes (e.g. `dir\`, `dir\file.txt`) and this causes
tar not being correctly extracted on Linux daemon.

This change assures we canonicalize all paths to unix
paths and add them to tar with that name independent of platform.

Fixes the following test cases for Windows CI:
- TestBuildAddFileWithWhitespace
- TestBuildCopyFileWithWhitespace
- TestBuildAddDirContentToRoot
- TestBuildAddDirContentToExistingDir
- TestBuildCopyDirContentToRoot
- TestBuildCopyDirContentToExistDir
- TestBuildDockerignore
- TestBuildEnvUsage
- TestBuildEnvUsage2

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
Upstream-commit: 28842d3f093e69cf62a090a532aacba1e6ff6d1c
Component: engine
2015-02-17 16:51:04 -08:00
05210fc269 Fixed relative filepath check
Signed-off-by: Jason Sommer <jsdirv@gmail.com>
Upstream-commit: 0826ac1581bdb71b889a0cb260422ce985aca317
Component: engine
2015-02-16 20:38:52 -06:00
084e9ad0b5 pkg/archive: test that confirms hardlink ordering
This test was written against
master(abdfb21e3a761efdd70614de42905ff7911c5372) as a failing test, but
works with this patch set.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 899a2dda097a57a12f8794ded4a706781173aa5d
Component: engine
2015-02-06 18:14:38 +01:00
6910db2df7 pkg/archive: sort files
sort changes found and exported.

Sorting the files before appending them to the tar archive
would mean a dependable ordering for types like hardlinks.

Also, combine sort logic used

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 32d6d49539f5876e6ef75f00db917d8a3aaa0569
Component: engine
2015-02-06 18:13:57 +01:00
299d22c2cc pkg/archive: remove tar autodetection log line
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
Upstream-commit: a5cc1c556dcd6dfe5c1aed4bec95aaff6ddfad61
Component: engine
2015-01-24 08:43:03 +02:00
1a4a1b2193 Have .dockerignore support Dockerfile/.dockerignore
If .dockerignore mentions either then the client will send them to the
daemon but the daemon will erase them after the Dockerfile has been parsed
to simulate them never being sent in the first place.

an events test kept failing for me so I tried to fix that too

Closes #8330

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 6d801a3caa54ad7ef574bc426aa1ffc412c5af82
Component: engine
2015-01-06 10:57:48 -08:00
9c05f0eaf9 Refactor to optimize storage driver ApplyDiff()
To avoid an expensive call to archive.ChangesDirs() which walks two directory
trees and compares every entry, archive.ApplyLayer() has been extended to
also return the size of the layer changes.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 35a22c9e12c05e2a0a205964702ced78ea39d7a1
Component: engine
2014-12-17 21:54:23 -08:00
d25c7e6450 Decompress archive before streaming the unpack in a chroot
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Conflicts:
	pkg/archive/archive.go
	pkg/chrootarchive/archive.go

Conflicts:
	pkg/archive/archive.go
Upstream-commit: 001ac15b54686761960352103ebf4ff2c6e1d803
Component: engine
2014-12-11 16:29:13 -05:00
a176492278 Update chroot apply layer to handle decompression outside chroot
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Conflicts:
	pkg/archive/diff.go
	pkg/chrootarchive/archive.go

Conflicts:
	pkg/archive/diff.go
	pkg/chrootarchive/diff.go
Upstream-commit: 7862f831fe99a221a0499b7764a8709e5f463bb9
Component: engine
2014-12-11 16:28:24 -05:00
717d7acf81 Fix invalid argument error on push
With 32ba6ab from #9261, TempArchive now closes the underlying file and
cleans it up as soon as the file's contents have been read. When pushing
an image, PushImageLayerRegistry attempts to call Close() on the layer,
which is a TempArchive that has already been closed. In this situation,
Close() returns an "invalid argument" error.

Add a Close method to TempArchive that does a no-op if the underlying
file has already been closed.

Signed-off-by: Andy Goldstein <agoldste@redhat.com>
Upstream-commit: 48ec176cd51da20e23564941da2d9906a7779d28
Component: engine
2014-12-03 16:12:24 -05:00
b86ab101dc Change path breakout detection logic in archive package
Fixes #9375

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: be5bfbe2217905ba129588fe17264b96c866e26d
Component: engine
2014-11-28 09:44:47 -08:00
0a5e96f3d3 archive: do not call FollowSymlinkInScope in createTarFile
Signed-off-by: Tibor Vass <teabee89@gmail.com>
Upstream-commit: f6d9780229bfa52c86762d49a7a7e644dcd8f6df
Component: engine
2014-11-25 01:03:41 +02:00
bc5bfe8ae5 archive: prevent breakout in ApplyLayer
Signed-off-by: Tibor Vass <teabee89@gmail.com>
Upstream-commit: 31d1d733037b22591e2dd2edfe6c4d2d4b8086cc
Component: engine
2014-11-25 01:03:41 +02:00
89c9d8d1a2 archive: prevent breakout in Untar
Signed-off-by: Tibor Vass <teabee89@gmail.com>
Upstream-commit: 1852cc38415c3d63d18c2938af9c112fbc4dfc10
Component: engine
2014-11-25 01:03:41 +02:00
588421ad7a archive: add breakout tests
Signed-off-by: Tibor Vass <teabee89@gmail.com>

Conflicts:
	pkg/archive/archive.go
		fixed conflict which git couldn't fix with the added BreakoutError

Conflicts:
	pkg/archive/archive_test.go
		fixed conflict in imports
Upstream-commit: 221617dbcd9431f14a3779d8bac9aba52f78ea21
Component: engine
2014-11-25 01:03:41 +02:00
86c00287ea pkg/archive: fix TempArchive cleanup w/ one read
This fixes the removal of TempArchives which can read with only one
read. Such archives weren't getting removed because EOF wasn't being
triggered.

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
Upstream-commit: 32ba6ab83c7e47d627a2b971e7f6ca9b56e1be85
Component: engine
2014-11-20 19:34:35 +02:00
46e167f95c Refactor pkg/archive with a platform-independent stat struct
pkg/archive contains code both invoked from cli (cross platform) and
daemon (linux only) and Unix-specific dependencies break compilation on
Windows. We extracted those stat-related funcs into platform specific
implementations at pkg/system and added unit tests.

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
Upstream-commit: 2180aa4f6f2ad4d8f284d63ee29e93547263976e
Component: engine
2014-11-14 18:20:54 -08:00
39256638f6 Extract mknod, umask, lstat to pkg/system
Some parts of pkg/archive is called on both client/daemon code. To get
it compiling on Windows, these funcs are extracted into files with
build tags.

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
Upstream-commit: 3d2fae353f6ddc819d3a3c4db80887a40ac6f5f0
Component: engine
2014-11-14 18:20:54 -08:00
40a04cf8f2 Fix comment to match the arg name
Signed-off-by: Steven Burgess <steven.a.burgess@hotmail.com>
Upstream-commit: 64a335ceac77dfd9eacc42e9d1f6fb2505e26e45
Component: engine
2014-11-11 18:01:08 -05:00
4888d6a9a1 pkg/archive: add interface for Untar
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
Upstream-commit: 14692d0d417378efc3456ddb810eae5646652bda
Component: engine
2014-11-11 18:28:33 +02:00
8e8fff205d Merge pull request #8813 from jlhawn/aufs_exclude_on_tar_layer
Exclude `.wh..wh.*` AUFS metadata on layer export
Upstream-commit: 6718791ea28be1bd6bce49cd9f49844c24f9dcf7
Component: engine
2014-11-04 11:38:12 -05:00
4f3ca6500e ./pkg/archive: clean up Stat_t assertion
inspired by @tonistiigi comment
(https://github.com/docker/docker/pull/8046/files#r19579960)

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 5e02468e76d61060f83a4d755b43f834981188f1
Component: engine
2014-10-30 16:50:33 -04:00
7239493b34 archive: cleanup and more information
Signed-off-by: Vincent Batts <vbatts@redhat.com>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
Upstream-commit: f14a9ed011d9b73104631310a13eab447d53be3a
Component: engine
2014-10-29 14:52:59 -04:00
c5a11d2981 archive: example app for diffing directories
By default is a demo of file differences, but can be used to create a
tar of changes between an old and new path.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
Upstream-commit: f710a8d7746df5f54e2cbe7b90885e4eb75920b4
Component: engine
2014-10-29 14:52:59 -04:00
87d83cfa00 archive: preserve hardlinks in Tar and Untar
* integration test for preserving hardlinks

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
Upstream-commit: f9f80443638fc2d703ee6205c8ef3db8e38db9a3
Component: engine
2014-10-29 14:52:52 -04:00
f5026cfb78 Exclude .wh..wh.* AUFS metadata on layer export
In an effort to make layer content 'stable' between import
and export from two different graph drivers, we must resolve
an issue where AUFS produces metadata files in its layers
which other drivers explicitly ignore when importing.

The issue presents itself like this:

    - Generate a layer using AUFS
    - On commit of that container, the new stored layer contains
      AUFS metadata files/dirs. The stored layer content has some
      tarsum value: '1234567'
    - `docker save` that image to a USB drive and `docker load`
      into another docker engine instance which uses another
      graph driver, say 'btrfs'
    - On load, this graph driver explicitly ignores any AUFS metadata
      that it encounters. The stored layer content now has some
      different tarsum value: 'abcdefg'.

The only (apparent) useful aufs metadata to keep are the psuedo link
files located at `/.wh..wh.plink/`. Thes files hold information at the
RW layer about hard linked files between this layer and another layer.
The other graph drivers make sure to copy up these psuedo linked files
but I've tested out a few different situations and it seems that this
is unnecessary (In my test, AUFS already copies up the other hard linked
files to the RW layer).

This changeset adds explicit exclusion of the AUFS metadata files and
directories (NOTE: not the whiteout files!) on commit of a container
using the AUFS storage driver.

Also included is a change to the archive package. It now explicitly
ignores the root directory from being included in the resulting tar archive
for 2 reasons: 1) it's unnecessary. 2) It's another difference between
what other graph drivers produce when exporting a layer to a tar archive.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 0d97e082c3b849a6901992e653b8963e8ef10f54
Component: engine
2014-10-28 10:14:05 -07:00
6c8bda9fe4 Merge pull request #8770 from LK4D4/logrus_support
Logrus support
Upstream-commit: 15b6b7be010546f30d7eabd000167d428efc0b13
Component: engine
2014-10-27 09:05:24 -07:00
c6209d5ca3 Merge pull request #8641 from vbatts/vbatts-archive_test_and_benchmark
archive: tests and benchmarks for hardlinks
Upstream-commit: 2b4173620586853480c0977743550dbe8c2697b7
Component: engine
2014-10-27 09:55:19 -04:00
bad39206ea Mass gofmt
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: ee7dd44c017458c8fe0be8e09569b1238366dca3
Component: engine
2014-10-24 15:11:48 -07:00
2d56e3cbc6 Use logrus everywhere for logging
Fixed #8761

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: 7c62cee51edc91634046b4faa6c6f1841cd53ec1
Component: engine
2014-10-24 15:03:06 -07:00
7c1ecdcafa archive: tests and benchmarks for hardlinks
Adding moar information, so benchmark comparisons can be moar
comparative.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 0fdf7839a21390f5813589195639caf594a3ddc2
Component: engine
2014-10-24 08:58:31 -04:00
94f641a2fe Make container.Copy support volumes
Fixes #1992

Right now when you `docker cp` a path which is in a volume, the cp
itself works, however you end up getting files that are in the
container's fs rather than the files in the volume (which is not in the
container's fs).
This makes it so when you `docker cp` a path that is in a volume it
follows the volume to the real path on the host.

archive.go has been modified so that when you do `docker cp mydata:/foo
.`, and /foo is the volume, the outputed folder is called "foo" instead
of the volume ID (because we are telling it to tar up
`/var/lib/docker/vfs/dir/<some id>` and not "foo", but the user would be
expecting "foo", not the ID

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: ef98fe0763024abd90bd5a573fec816895ee92e4
Component: engine
2014-10-20 20:23:01 -04:00
afe8e130e0 Move archive package into pkg/archive
Now that the archive package does not depend on any docker-specific
packages, only those in pkg and vendor, it can be safely moved into pkg.

Signed-off-by: Rafe Colton <rafael.colton@gmail.com>
Upstream-commit: 30d5a42c1f24e26f681b7330249f04fec891aee9
Component: engine
2014-09-29 23:23:36 -07:00