Commit Graph

94 Commits

Author SHA1 Message Date
78d7be4aeb layer/layer_store: ensure NewInputTarStream resources are released
In applyTar, if the driver's ApplyDiff returns an error, the function
returns early without calling io.Copy.

As a consequence, the resources (a goroutine and some buffers holding
the uncompressed image, the digest, etc...) allocated or referenced by
NewInputTarStream above aren't released, as the worker goroutine only
finishes when it finds EOF or a closed pipe.

Signed-off-by: Sergio Lopez <slp@redhat.com>
(cherry picked from commit 5846db10af9fb37061ab92a07c3d82fbea92b2e0)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: f660ef2c25590f21fdd10357c08a542a4876d6c3
Component: engine
2019-03-01 23:14:27 +01:00
7414934b6c Add ADD/COPY --chown flag support to Windows
This implements chown support on Windows. Built-in accounts as well
as accounts included in the SAM database of the container are supported.

NOTE: IDPair is now named Identity and IDMappings is now named
IdentityMapping.

The following are valid examples:
ADD --chown=Guest . <some directory>
COPY --chown=Administrator . <some directory>
COPY --chown=Guests . <some directory>
COPY --chown=ContainerUser . <some directory>

On Windows an owner is only granted the permission to read the security
descriptor and read/write the discretionary access control list. This
fix also grants read/write and execute permissions to the owner.

Signed-off-by: Salahuddin Khan <salah@docker.com>
Upstream-commit: 763d8392612942ff5c32a35f8bdafd7ae93d3321
Component: engine
2018-08-13 21:59:11 -07:00
c086db14b7 layer: relax graphdriver ID format
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 9a0eb8d330797fa62dc59667aea6efbb7cdb9181
Component: engine
2018-06-10 10:05:26 -07:00
853163c7ac daemon: access to distribution internals
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: ea36c3cbaf74c4e69307563cb4deb20e560217ac
Component: engine
2018-06-10 10:05:26 -07:00
b6580d6c65 Remove metadata store interface
Layer metadata storage has not been implemented outside of the layer
store and will be deprecated by containerd metadata storage. To prepare
for this and freeze the current metadata storage, remove the exported
interface and make it internal to the layer store.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Upstream-commit: 0aebcbc32dc6a7b35982a2bfc44335562cbb68ec
Component: engine
2018-03-06 10:42:00 -08:00
be83c11fb0 Add canonical import comment
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 4f0d95fa6ee7f865597c03b9e63702cdcb0f7067
Component: engine
2018-02-05 16:51:57 -05:00
4de8cf5f5e Golint fix with ro_layer.go
A small golint fix with ro_layer.go.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 19918b88b7b9fe6fc668847f31c94068c78ef2d1
Component: engine
2018-01-24 18:24:03 +00:00
3ca8db9a46 Remove OS() from layer interface
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: c94d34f783944ff6586846ccd11e86925fcee171
Component: engine
2018-01-18 12:56:28 -08:00
40b95b8e94 Address feedback from Tonis
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 0cba7740d41369eee33b671f26276325580bc07b
Component: engine
2018-01-18 12:30:39 -08:00
852153685d LCOW: Refactor to multiple layer-stores based on feedback
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: afd305c4b5682fbc297e1685e2b7a49628b7c7f0
Component: engine
2018-01-18 08:31:05 -08:00
33860da10b LCOW: Re-coalesce stores
Signed-off-by: John Howard <jhoward@microsoft.com>

The re-coalesces the daemon stores which were split as part of the
original LCOW implementation.

This is part of the work discussed in https://github.com/moby/moby/issues/34617,
in particular see the document linked to in that issue.
Upstream-commit: ce8e529e182bde057cdfafded62c210b7293b8ba
Component: engine
2018-01-18 08:29:19 -08:00
621388138c Golint: remove redundant ifs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: b4a63139696aea2c73ec361a9af8b36a118f0423
Component: engine
2018-01-15 00:42:25 +01:00
608a03b9d5 Have VFS graphdriver use accelerated in-kernel copy
This change makes the VFS graphdriver use the kernel-accelerated
(copy_file_range) mechanism of copying files, which is able to
leverage reflinks.

Signed-off-by: Sargun Dhillon <sargun@sargun.me>
Upstream-commit: d2b71b26604370620630d8d3f35aba75ae474f3f
Component: engine
2017-11-28 14:59:56 -08:00
eefbd135ae Remove solaris build tag and `contrib/mkimage/solaris
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 4785f1a7ab7ec857dc3ca849ee6ecadf519ef30e
Component: engine
2017-11-02 00:01:46 +00:00
35db73fa01 LCOW: API: Add platform to /images/create and /build
Signed-off-by: John Howard <jhoward@microsoft.com>

This PR has the API changes described in https://github.com/moby/moby/issues/34617.
Specifically, it adds an HTTP header "X-Requested-Platform" which is a JSON-encoded
OCI Image-spec `Platform` structure.

In addition, it renames (almost all) uses of a string variable platform (and associated)
methods/functions to os. This makes it much clearer to disambiguate with the swarm
"platform" which is really os/arch. This is a stepping stone to getting the daemon towards
fully multi-platform/arch-aware, and makes it clear when "operating system" is being
referred to rather than "platform" which is misleadingly used - sometimes in the swarm
meaning, but more often as just the operating system.
Upstream-commit: 0380fbff37922cadf294851b1546f4c212c7f364
Component: engine
2017-10-06 11:44:18 -07:00
a8090896a0 Merge pull request #34252 from Microsoft/akagup/lcow-remotefs-sandbox
LCOW: Support for docker cp, ADD/COPY on build
Upstream-commit: a5f9783c930834b8e6035fb0ad9c22fd4bbfc355
Component: engine
2017-09-15 16:49:48 -07:00
ae2d031a76 add testcase in layer/empty_test.go with Metadata()
Signed-off-by: chchliang <chen.chuanliang@zte.com.cn>
Upstream-commit: c72112b171ac046d11e8279b799315e962332450
Component: engine
2017-09-15 14:13:48 +08:00
cddfe04f6a LCOW: Implemented support for docker cp + build
This enables docker cp and ADD/COPY docker build support for LCOW.
Originally, the graphdriver.Get() interface returned a local path
to the container root filesystem. This does not work for LCOW, so
the Get() method now returns an interface that LCOW implements to
support copying to and from the container.

Signed-off-by: Akash Gupta <akagup@microsoft.com>
Upstream-commit: 7a7357dae1bcccb17e9b2d4c7c8f5c025fce56ca
Component: engine
2017-09-14 12:07:52 -07:00
d659edcaf5 Update logrus to v1.0.1
Fixes case sensitivity issue

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Upstream-commit: 1009e6a40b295187e038b67e184e9c0384d95538
Component: engine
2017-07-31 13:16:46 -07:00
abfe031053 Merge pull request #33713 from x1022as/error_fd
fd leak and error handling
Upstream-commit: 3be2273d03e4b06dff4006b1a600c578c7aa09fc
Component: engine
2017-07-06 16:47:34 -07:00
9a5747b3f9 LCOW: Fix nits from 33241
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 4ec9766a27ffb964cec6b8b2745725965b2644aa
Component: engine
2017-06-27 11:59:49 -07:00
c41db1dd55 fd leak and error handling
Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
Upstream-commit: 0042f992d80b59b97380bbbbeb271fd3030edd90
Component: engine
2017-06-23 15:38:35 +08:00
30a1a8646e LCOW: Store integrity checks
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 87abf34a3d7bb63e3948eb1d801ac43b379d779e
Component: engine
2017-06-20 19:49:53 -07:00
8508f49b3f LCOW: Pass platform through into layer store
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 42c5c1a9ec14f00d5a5367131493cbd6de7d72b0
Component: engine
2017-06-20 09:21:37 -07:00
04857f417d LCOW: Adds platform to the layer store
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: fc21bf280bac39377d3a236efa87f5c8cbadfb9f
Component: engine
2017-06-20 09:00:32 -07:00
932c771fa1 Remove CopyOnBuild from the daemon.
Add CreateImage() to the daemon
Refactor daemon.Comit() and expose a Image.NewChild()
Update copy to use IDMappings.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: bd5f92d2631df7c932b93e72e45b39cba19f2f3b
Component: engine
2017-06-08 15:06:54 -04:00
5d87b0ddc9 Remove unused functions from archive.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 967ef7e6d2bd88a5d7010863f3d7138ca61b1939
Component: engine
2017-06-07 11:44:33 -04:00
779caabedf Partial refactor of UID/GID usage to use a unified struct.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 09cd96c5ad2de369912cdf708c3c50f41e4586ac
Component: engine
2017-06-07 11:44:33 -04:00
631fdf6cda Let graphdrivers declare diff stream fidelity
This allows graphdrivers to declare that they can reproduce the original
diff stream for a layer. If they do so, the layer store will not use
tar-split processing, but will still verify the digest on layer export.
This makes it easier to experiment with non-default diff formats.

Signed-off-by: Alfred Landrum <alfred.landrum@docker.com>
Upstream-commit: aa96c3176bf9dc6e14c6bbcf065ceb3a3870886a
Component: engine
2017-03-31 08:32:00 -07:00
42e1c80fbb modify ID to ChainID to avoid confusing
Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
Upstream-commit: 1b0f2d71a1aa9e529357e2ffe342af2a12d7c145
Component: engine
2017-03-09 16:59:04 +08:00
9768c5da08 Windows: Remove redundant 'GraphDriver() func
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 2cd8bcd7df1b1a204fe20118afe9556fe5a0b7ba
Component: engine
2017-01-12 15:32:46 -08:00
2401da5f36 Windows: Remove dead code RegisterDiffIDs
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 02ed83aee95e506ace3a994bb2ebb7e94df5a438
Component: engine
2017-01-09 08:56:34 -08:00
775c5633ef *: use opencontainers/go-digest package
The `digest` data type, used throughout docker for image verification
and identity, has been broken out into `opencontainers/go-digest`. This
PR updates the dependencies and moves uses over to the new type.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
Upstream-commit: 7a855799175b6b984886ef1cfa337d6df1d4c668
Component: engine
2017-01-06 18:48:41 -08:00
38849b2667 Moves graphdriver plugn docs out of experimental
Also updates some of the structures being sent so plugins are getting
all the new options.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 677fa03654886ee776ff478c30681d5376cfc196
Component: engine
2016-12-22 15:30:25 -05:00
bdb282b28d Fix some typos
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
Upstream-commit: c8c7a3ff2112a1b17a06fc02633ed7b49a8aebf3
Component: engine
2016-11-30 03:01:32 +08:00
98fb763827 Move CreateRWLayer() parameters in a struct
Move some of the optional parameters of CreateRWLayer() in a struct
called CreateRWLayerOpts. This will make it easy to add more options
arguments without having to change signature of CreateRWLayer().

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: f7f3d34210fd8d25a929c6b9048e74e7ee40a558
Component: engine
2016-11-16 16:31:23 -05:00
459e915b2e Pass all graphdriver create() parameters in a struct
This allows for easy extension of adding more parameters to existing
parameters list. Otherwise adding a single parameter changes code
at so many places.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: b937aa8e6968d805527d163e6f477d496ceb88d7
Component: engine
2016-11-09 15:59:58 -05:00
fb8fd8dbba Merge pull request #28006 from dmcgowan/clean-overlay2-layerstore
Cleanup invalid code in overlay2 and layer store
Upstream-commit: 1f4137857f6eb8edcbefe591e1abe04d83da3416
Component: engine
2016-11-02 23:16:38 -07:00
94f5e97be8 Cleanup invalid code in overlay2 and layer store
The overlay2 change ensures that the correct path is used to resolve the
symlink. The current code will not fail since the symlinks are always given
a value of "../id/diff" which ends up ignoring the incorrect "link" value.
Fix this code so it doesn't cause unexpected errors in the future if the
symlink changes.

The layerstore cleanup ensures that the empty layer returns a tar stream if
the provided parent is empty. Any value other than empty still returns an
error since the empty layer has no parent. Currently empty layer is not
used anywhere that TarStreamFrom is used but could break in the future if
this function is called.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 6622cc970e27a7bf2798d751ed276265a3a2d404
Component: engine
2016-11-02 16:13:53 -07:00
4bfee6fd15 Remove TarStreamFrom from RWLayer interface
RWLayers do not implement the tar stream from, moved the
definition to Layer instead of TarStreamer

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 8625d25351df680a0571c906ea0b59bf8092e0c6
Component: engine
2016-11-01 14:44:27 -07:00
c7c95dc226 Adds ability to squash image after build
Allow built images to be squash to scratch.
Squashing does not destroy any images or layers, and preserves the
build cache.

Introduce a new CLI argument --squash to docker build
Introduce a new param to the build API endpoint `squash`

Once the build is complete, docker creates a new image loading the diffs
from each layer into a single new layer and references all the parent's
layers.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 362369b4bbea38881402d281ee2015d16e8b10ce
Component: engine
2016-11-01 13:41:59 -04:00
fe1dce6a91 pkg/archive: remove unnecessary Archive and Reader type
The `archive` package defines aliases for `io.ReadCloser` and
`io.Reader`. These don't seem to provide an benefit other than type
decoration. Per this change, several unnecessary type cases were
removed.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
Upstream-commit: aa2cc18745cbe0231c33782f0fa764f657e3fb88
Component: engine
2016-10-20 19:31:24 -07:00
effa6f4094 Update plugingetter import path in docker/docker.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: a98be0344b24d71235c17a87ff425f3d602e48e8
Component: engine
2016-10-11 11:24:18 -07:00
c643e4b3fd Add Map() method to LayerStore interface
This method return a map associating a chain ID to its layer object

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: 148aef9199ef0af6d03ea53e616c9fbd23b7c5ec
Component: engine
2016-09-29 07:42:53 -07:00
952f960124 layer_store: Use CreateReadWrite() for -init layer instead of Create()
init layer is read/write layer and not read only layer. Following commit
introduced new graph driver method CreateReadWrite.

ef5bfad Adding readOnly parameter to graphdriver Create method

So far only windows seem to be differentiating between above two methods.
Making this change to make sure -init layer calls right method so that
we don't have surprises in future.

Windows does not need init layer. This patch also gets rid of creation of
init layer on windows.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 2508ca000e79dfe1a956b0078a0d196dd6b66dab
Component: engine
2016-09-21 14:45:25 -04:00
f07146ebf8 Make graphdrivers work with pluginv2.
As part of making graphdrivers support pluginv2, a PluginGetter
interface was necessary for cleaner separation and avoiding import
cycles.

This commit creates a PluginGetter interface and makes pluginStore
implement it. Then the pluginStore object is created in the daemon
(rather than by the plugin manager) and passed to plugin init as
well as to the different subsystems (eg. graphdrivers, volumedrivers).
A side effect of this change was that some code was moved out of
experimental. This is good, since plugin support will be stable soon.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: fefea805e930a67fb6327f8e59415932861358cb
Component: engine
2016-09-20 08:49:48 -07:00
3b1269cdeb Merge pull request #25523 from dmcgowan/fsync-layer-filestore
Update layer store to sync transaction files before committing
Upstream-commit: bc06542a1715273acc087dadd8179a88386dd6fb
Component: engine
2016-09-08 10:03:12 -07:00
1c502571ef add defer file.Close to avoid potential fd leak
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 0ead624473b6bddc232b46bc7c76ab4f9c743ff5
Component: engine
2016-08-10 08:36:09 +08:00
2f8f4c65f9 Update layer store to sync transaction files before committing
Fixes case where shutdown occurs before content is synced to disked
on layer creation. This case can leave the layer store in an bad
state and require manual recovery. This change ensures all files
are synced to disk before a layer is committed. Any shutdown that
occurs will only cause the layer to not show up but will allow it to
be repulled or recreated without error.

Added generic io logic to ioutils package to abstract it out of
the layer store package.


Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Upstream-commit: c37bd10f8cfc4cb6df5513881eed53e6c5f0be09
Component: engine
2016-08-09 11:55:17 -07:00
923b4bd8ef fix some typos
Signed-off-by: bin liu <liubin0329@gmail.com>
Upstream-commit: 950073aabb305db6156709ea8509b1f72ff06f3b
Component: engine
2016-06-21 15:29:25 +08:00