Commit Graph

189 Commits

Author SHA1 Message Date
643654c2f0 Spelling fixes
* additional
* ambiguous
* anonymous
* anything
* application
* because
* before
* building
* capabilities
* circumstances
* commit
* committer
* compresses
* concatenated
* config
* container
* container's
* current
* definition
* delimiter
* disassociates
* discovery
* distributed
* doesnotexist
* downloads
* duplicates
* either
* enhancing
* enumerate
* escapable
* exactly
* expect
* expectations
* expected
* explicitly
* false
* filesystem
* following
* forbidden
* git with
* healthcheck
* ignore
* independent
* inheritance
* investigating
* irrelevant
* it
* logging
* looking
* membership
* mimic
* minimum
* modify
* mountpoint
* multiline
* notifier
* outputting
* outside
* overridden
* override
* parsable
* plugins
* precedence
* propagation
* provided
* provides
* registries
* repositories
* returning
* settings
* should
* signals
* someone
* something
* specifically
* successfully
* synchronize
* they've
* thinking
* uninitialized
* unintentionally
* unmarshaling
* unnamed
* unreferenced
* verify

Signed-off-by: Josh Soref <jsoref@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 39bcaee47b8a284a46b761afe218ba7deda0d482
Component: engine
2017-07-03 13:13:09 -07:00
8d232fdb68 Refactor MountPoint Setup function in volume.go
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Upstream-commit: fb8b27cd41c92c9a739be70dee11f6e6ffffafdf
Component: engine
2017-06-30 11:09:49 +03:00
5a81510449 Do not error on relabel when relabel not supported
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: ebfdfc5768b74e0a52875cf76a0576bfcd66445c
Component: engine
2017-06-26 17:29:24 -04:00
a4b1e4c35b Merge pull request #29083 from cpuguy83/fix_volume_rm_metadata
[1.12.x] Fix issue where volume metadata was not removed
(cherry picked from commit 7613b23a583dba87f18005076ecbc84b408ebc5c)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Conflicts:
	volume/store/store.go
	volume/store/store_test.go
Upstream-commit: 9ffbc8b8144917deed71a35d2f044f6e674c66f5
Component: engine
2017-06-09 13:44:59 +02: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
91bac6c3f8 Merge pull request #33330 from coolljt0725/fix_sock_is_dir
Don't create source directory while the daemon is being shutdown, fix #30348
Upstream-commit: cd2255a296acf8408d2afb65b897560479f1ecd3
Component: engine
2017-06-07 12:37:08 +09:00
fe2c9ff86c Don't create source directory while the daemon is being shutdown, fix #30348
If a container mount the socket the daemon is listening on into
container while the daemon is being shutdown, the socket will
not exist on the host, then daemon will assume it's a directory
and create it on the host, this will cause the daemon can't start
next time.

fix issue https://github.com/moby/moby/issues/30348

To reproduce this issue, you can add following code

```
--- a/daemon/oci_linux.go
+++ b/daemon/oci_linux.go
@@ -8,6 +8,7 @@ import (
        "sort"
        "strconv"
        "strings"
+       "time"

        "github.com/Sirupsen/logrus"
        "github.com/docker/docker/container"
@@ -666,7 +667,8 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
        if err := daemon.setupIpcDirs(c); err != nil {
                return nil, err
        }
-
+       fmt.Printf("===please stop the daemon===\n")
+       time.Sleep(time.Second * 2)
        ms, err := daemon.setupMounts(c)
        if err != nil {
                return nil, err

```

step1 run a container which has `--restart always` and `-v /var/run/docker.sock:/sock`
```
$ docker run -ti --restart always -v /var/run/docker.sock:/sock busybox
/ #

```
step2 exit the the container
```
/ # exit
```
and kill the daemon when you see
```
===please stop the daemon===
```
in the daemon log

The daemon can't restart again and fail with `can't create unix socket /var/run/docker.sock: is a directory`.

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: 7318eba5b2f8bb4b867ca943c3229260ca98a3bc
Component: engine
2017-05-30 22:59:51 -04:00
7acd97d8f9 Merge pull request #33257 from mtesselH/master
Add CreatedAt filed to volume. Display when volume is inspected.
Upstream-commit: 79b19c2e16c43f22187538953f49b2c048b063f8
Component: engine
2017-05-29 10:48:07 +01:00
3d97792442 Add CreatedAt filed to volume. Display when volume is inspected.
Closes #32663 by adding CreatedAt field when volume is created.
Displaying CreatedAt value when volume is inspected
Adding tests to verfiy the new field is correctly populated

Signed-off-by: Marianna <mtesselh@gmail.com>

Moving CreatedAt tests from the CLI

Moving the tests added for the newly added CreatedAt field for Volume, from CLI to API tests

Signed-off-by: Marianna <mtesselh@gmail.com>
Upstream-commit: a46f757c4043031379362c5d6b3bad7562ab9fed
Component: engine
2017-05-26 11:47:02 -07:00
25ad1db09f Merge pull request #32909 from cpuguy83/32907_volume_unmount_on_cp
Add refcount for MountPoint
Upstream-commit: 09ff5ce29c82b6c97123b24855e1ef11e860b47a
Component: engine
2017-05-09 20:15:41 +02:00
79f9dd11cc Merge pull request #32687 from runcom/oci-selinux
Switch to using opencontainers/selinux for selinux bindings
Upstream-commit: 4219156a6254bdc7d270f06742037df8e2708a9a
Component: engine
2017-04-29 19:05:32 +02:00
ce01ee60c2 Add refcount for MountPoint
This makes sure that multiple users of MountPoint pointer can
mount/unmount without affecting each other.

Before this PR, if you run a container (stay running), then do `docker
cp`, when the `docker cp` is done the MountPoint is mutated such that
when the container stops the volume driver will not get an Unmount
request. Effectively there would be two mounts with only one unmount.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: df0d317a64e4a74433359e826bc1d606e050a5ed
Component: engine
2017-04-28 16:01:25 -04:00
16a9e0d85d Merge pull request #32851 from rhvgoyal/volume-propagation
Volumes should have default propagation property "rprivate"
Upstream-commit: eaae8a9a9ca2b26ede363f11904a80a26aa1ee77
Component: engine
2017-04-28 08:58:10 -04:00
1824504fe7 Ensure unmount before removing local volume.
When there is an error unmounting a local volume, it is still possible
to call `Remove()` on the volume causing removal of the mounted
resources which is generally not desirable.

This ensures that resources are unmounted before attempting removal.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: db3576f8a08ca70287bd3fdf9b21e162537f9d3a
Component: engine
2017-04-27 16:41:03 -04:00
597451657d Volumes should have default propagation property "rprivate"
Until and unless user has specified a propagation property for volume, they
should default to "rprivate" and it should be passed to runc.

We can't make it conditional on HasPropagation(). GetPropagation() returns
default of rprivate if noting was passed in by user.

If we don't pass "rprivate" to runc, then bind mount could be shared even
if user did not ask for it. For example, mount two volumes in a container.
One is "shared" while other's propagation is not specified by caller. If
both volume has same source mount point of "shared", then second volume
will also be shared inside container (instead of being private).

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: af8a1430f1c1a9d4c45c7d722b90c19094171651
Component: engine
2017-04-26 16:27:50 -04:00
9432bd8249 Switch to using opencontainers/selinux for selinux bindings
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: abbbf914986d6d0ea15923f9a57a99465791bc83
Component: engine
2017-04-24 21:29:47 +02:00
1139afd6ff Fix panic on error looking up volume driver
(-‸ლ)

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 5baf8a411899b1aa39f921df8debfd925491be68
Component: engine
2017-04-04 09:22:01 -04:00
250a383735 Add non-nil check before logging volume errors.
Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
Upstream-commit: b1570baadd76377aaeb7199c95ad6dc11b38f302
Component: engine
2017-03-24 16:34:11 -07:00
93ad69786f Add 'consistent', 'cached', and 'delegated' mode flags
This adds 'consistency' mode flags to the mount command line argument.
Initially, the valid 'consistency' flags are 'consistent', 'cached',
'delegated', and 'default'.

Signed-off-by: David Sheets <dsheets@docker.com>
Signed-off-by: Jeremy Yallop <yallop@docker.com>
Upstream-commit: f13297c0beaf4fcc6742a9f3c047cbfeef955ac1
Component: engine
2017-03-01 18:13:47 +00:00
f0ff2a48ad sort volume drivers and auth plugins in info response
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 1d1362bdb2fd8ddbcb0e3bf10afc25c346c023ea
Component: engine
2017-02-01 12:01:49 +08:00
fae10cddd0 Fixup use of Error() with format string to use Errorf()
Signed-off-by: Adam Eijdenberg <adam.eijdenberg@gmail.com>
Upstream-commit: 8bad0ab1399ae756995e2d6e65c1945bfb2fbe35
Component: engine
2017-01-28 22:46:56 +11:00
2e5c358a33 Merge pull request #29428 from rhatdan/selinux
We need to fix labels if the user requests on volumes
Upstream-commit: 541150da53ea84b0fb86342bfd3e32483e2018ca
Component: engine
2017-01-26 11:47:14 -08:00
142454692f validate mount path for tmpfs
There was no validation for `docker run --tmpfs foo`.

In this PR, only two obvious rules are implemented:
 - path must be absolute
 - path must not be "/"
We should add more rules carefully.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Upstream-commit: 4a8799dc0a000a74eae49a01b054ae687bc18f73
Component: engine
2017-01-20 06:01:48 +00:00
140c56ac38 Merge pull request #28925 from daehyeok/ineffassign
Refactoring ineffectual assignments
Upstream-commit: 5eda0c59477a7364878351c3d311cd3a4c6dd28d
Component: engine
2017-01-18 15:01:57 +01:00
ad5a24f0ae Merge pull request #28690 from zteBill/volume-errorinfo-inexact
repeated volume create information
Upstream-commit: fa4f09194f7dd6687ac073f51ab344de2f165071
Component: engine
2017-01-15 17:10:27 +01:00
287ee51be3 Refactoring ineffectual assignments
This patch fixed below 4 types of code line
1. Remove unnecessary variable assignment
2. Use variables declaration instead of explicit initial zero value
3. Change variable name to underbar when variable not used
4. Add erro check and return for ignored error

Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
Upstream-commit: 6306019d0bad9c4e60ee437e93f2450dfb0b68c0
Component: engine
2017-01-13 00:27:01 -07:00
1903b00ea0 We need to fix labels if the user requests on volumes
Currently local volumes and other volumes that support SELinux do
not get labeled correctly.  This patch will allow a user to specify
:Z or :z when  mounting a volume and have it fix the label of the newly
created volume.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
Upstream-commit: 0c791c8e9f462b0df2c1a76aff45b9033bd962cd
Component: engine
2017-01-10 09:39:31 -05:00
b3e47ec408 Merge pull request #29564 from aaronlehmann/getter-types
plugingetter: Avoid all caps for constant declarations
Upstream-commit: 9c96768eae4b3a65147b47a55c850c103ab8972d
Component: engine
2017-01-10 09:35:19 +01:00
c2674c6655 Fix minor typo
Signed-off-by: Josh Eveleth <joshe@opendns.com>
Upstream-commit: eee0cfa45dd75223dec204428dc85dccb2b5abe9
Component: engine
2017-01-05 12:45:56 -08:00
092b719cd9 Merge pull request #29903 from Microsoft/jjh/volumetest-tp5
Windows: Fix TP5 volume unit tests TODOs
Upstream-commit: 7ad34996bc88ce13ad4d7fb9b89be57366e75bb0
Component: engine
2017-01-05 09:53:31 +01:00
75ea28e3b8 Windows: Fix old TP5 volume unit tests
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: cc3e59c44e997c6c399415d1378072f247129230
Component: engine
2017-01-04 16:17:55 -08:00
5bd9457743 Correct comment in vol driver interface
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: c2246f28f6bd8f4ebc333cfdb8a9e8ab6d1b7845
Component: engine
2017-01-04 12:06:37 -08:00
8b3646ee75 plugingetter: Avoid all caps for constant declarations
Go style calls for mixed caps instead of all caps:
https://golang.org/doc/effective_go.html#mixed-caps

Change LOOKUP, ACQUIRE, and RELEASE to Lookup, Acquire, and Release.

This vendors a fork of libnetwork for now, to deal with a cyclic
dependency issue. The change will be upstream to libnetwork once this is
merged.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 428600108cce0a11e65ec4ebd9e439e947b55da7
Component: engine
2017-01-04 10:19:04 -08:00
478844dff8 Implement content addressability for plugins
Move plugins to shared distribution stack with images.

Create immutable plugin config that matches schema2 requirements.

Ensure data being pushed is same as pulled/created.

Store distribution artifacts in a blobstore.

Run init layer setup for every plugin start.

Fix breakouts from unsafe file accesses.

Add support for `docker plugin install --alias`

Uses normalized references for default names to avoid collisions when using default hosts/tags.

Some refactoring of the plugin manager to support the change, like removing the singleton manager and adding manager config struct.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Upstream-commit: 3d86b0c79b16334ce5836c0315e4c310b84c2e17
Component: engine
2016-12-23 13:29:58 -08:00
ba9d83b3bc Merge pull request #29664 from cpuguy83/fix_bolt_usage
Fix usage of boltdb in volume restore
Upstream-commit: d25186a625ca94ec1d4a814dd8745fd3ca335caa
Component: engine
2016-12-22 13:53:04 -08:00
4d0b32f2ac Fix usage of boltdb in volume restore
bolt k/v pairs are only valid for the life of a transaction.
This means the memory that the k/v pair is referencing may be invalid if
it is accessed outside of the transaction.
This can potentially cause a panic.

For reference: https://godoc.org/github.com/boltdb/bolt#hdr-Caveats

To fix this issue, unmarshal the stored data into volume meta before
closing the transaction.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 4876a9047ebfd66294d88482a1b4b24634a632e6
Component: engine
2016-12-22 11:56:02 -05:00
433a6ae35a Merge pull request #29314 from vdemeester/no-more-utils
Remove the utils package
Upstream-commit: b9ee31ae027bbd62477fea3f58023c90f051db00
Component: engine
2016-12-22 15:21:05 +01:00
36a05ce983 Move names to package api
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: dba271a42ab4841dbcf2e953491e9ee728cd8e16
Component: engine
2016-12-21 22:42:47 +01:00
0a2ba8aaae Merge pull request #29378 from aaronlehmann/swarm-plugins
Support v2 plugins in swarm mode
Upstream-commit: eb59c6d587ab5d3a49f044b4399046c0979bd1af
Component: engine
2016-12-19 11:07:06 +01:00
8616ae37b9 Merge pull request #29423 from unclejack/api_cli_integ_return
return directly without ifs in remaining packages
Upstream-commit: 21210419447281863f239805ab19248733041a52
Component: engine
2016-12-17 21:30:47 +01:00
6f94fb07b2 Fix volume Create to check against canonical driver name
Previously, it was comparing against the driver name passed in by the
caller. This could lead to subtle issues when using plugins, like
"plugin" vs. "plugin:latest".

Also, remove "conflict:" prefix to improve the error message.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 53d447c5d5c85d5595d5170411189c88a135a789
Component: engine
2016-12-16 10:45:46 -08:00
343586bbdc Fix volume plugin refecounting on daemon restart
Ensures all known volumes (known b/c they are persisted to disk) have
their volume drivers refcounted properly.

In testing this, I found an issue with `--live-restore` (required since
currently the provided volume plugin doesn't keep state on restart)
where restorted plugins did not have a plugin client loaded causing a
panic when trying to use the plugin.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 6ef1060cd0acb847e06db890abb335faa837a9e2
Component: engine
2016-12-16 10:14:06 -05:00
d363742779 return directly without ifs in remaining packages
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
Upstream-commit: 2c187a24e0003f2f0ab90b85876e668f2b6210d4
Component: engine
2016-12-14 23:28:27 +02:00
6dcc37964b Refcount graphdriver plugins properly
Adds 2 new methods to v2 plugin `Acquire` and `Release` which allow
refcounting directly at the plugin level instead of just the store.
Since a graphdriver is initialized exactly once, and is really managed
by a separate object, it didn't really seem right to call
`getter.Get()` to refcount graphdriver plugins.
On shutdown it was particularly weird where we'd either need to keep a
driver reference in daemon, or keep a reference to the pluggin getter in
the layer store, and even then still store extra details on if the
graphdriver is a plugin or not.

Instead the plugin proxy itself will handle calling the neccessary
refcounting methods directly on the plugin object.

Also adds a new interface in `plugingetter` to account for these new
functions which are not going to be implemented by v1 plugins.

Changes terms `plugingetter.CREATE` and `plugingetter.REMOVE` to
`ACQUIRE` and `RELEASE` respectively, which seems to be better
adjectives for what we're doing.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: f29bbd16f5d2bb82d815ea59f8ef85fe59384c89
Component: engine
2016-12-09 19:46:28 -05:00
6b1a2692bb Merge pull request #26398 from tiborvass/plugin-fixes
plugins: container-rootfs-relative paths
Upstream-commit: 0a072e93df6ad10e37bbf0b1f540fff7b7581a75
Component: engine
2016-12-09 12:48:59 -08:00
656f60dc73 plugins: container-rootfs-relative paths
Legacy plugins expect host-relative paths (such as for Volume.Mount).
However, a containerized plugin cannot respond with a host-relative
path. Therefore, this commit modifies new volume plugins' paths in Mount
and List to prepend the container's rootfs path.

This introduces a new PropagatedMount field in the Plugin Config.
When it is set for volume plugins, RootfsPropagation is set to rshared
and the path specified by PropagatedMount is bind-mounted with rshared
prior to launching the container. This is so that the daemon code can
access the paths returned by the plugin from the host mount namespace.

Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: c54b717caf1a55e525ce180bfcb42addd59c6633
Component: engine
2016-12-09 10:16:24 -08:00
795fc21c8b Fix a bit typos
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
Upstream-commit: 11454e1c97ed5495e77a06868a0c199d81aa96c3
Component: engine
2016-12-09 03:05:11 +08:00
8e87df7fd3 volume: Use a map of maps for VolumeStore.refs
The current implementation of getRefs is a bit fragile. It returns a
slice to callers without copying its contents, and assumes the contents
will not be modified elsewhere.

Also, the current implementation of Dereference requires copying the
slice of references, excluding the one we wish to remove.

To improve both of these things, change refs to be a map of maps.
Deleting an item becomes trivial, and returning a slice of references
necessitates copying from the map.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: a762222396d21990b2c0772300660312e7a58b6c
Component: engine
2016-12-05 15:39:05 -08:00
6be6989ae5 Merge pull request #28994 from cpuguy83/allow_vol_recreate_for_same_driver
Fix out-of-band vol delete+create for same driver
Upstream-commit: 42aafe725ff20c6a97f7e4e06b3ec5ee9e615fb3
Component: engine
2016-12-02 15:12:13 -08:00
35ebad64e3 check testing code for runconfig and volume
Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
Upstream-commit: b3e5137856ffd07e179d977eec74ee0566f1bb26
Component: engine
2016-12-01 17:07:38 +08:00