Commit Graph

171 Commits

Author SHA1 Message Date
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
45d64c96a6 Fix out-of-band vol delete+create for same driver
Fix issue where out-of-band deletions and then a `docker volume create`
on the same driver caused volume to not be re-created in the driver but
return as created since it was stored in the cache.

Previous fix only worked if the driver names did not match.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: d8ce4a6e108f4f870228912f105eed8218e087e4
Component: engine
2016-11-30 12:19:03 -05:00
154b3f0e4f Restrict checkpoint name to prevent directory traversal
This fix tries to address the issue raised in 28769 where
checkpoint name was not checked before passing to containerd.
As a result, it was possible to use a special checkpoint name
to get outside of the container's directory.

This fix add restriction `[a-zA-Z0-9][a-zA-Z0-9_.-]+` (`RestrictedNamePattern`).
This is the same as container name restriction.

This fix fixes 28769.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: c90ec0517544e7d054d79f71f4d24d9ebbad7408
Component: engine
2016-11-23 13:23:07 -08:00
641ac0f952 check err type
Signed-off-by: zteBill <bi.zhenkun@zte.com.cn>
Upstream-commit: 47b110a59295a2713fb18114f3afed7e2421d5e2
Component: engine
2016-11-24 01:33:02 +08:00
14f731c22d Use container Mounts API for Swarm containers.
Instead of converting nicely typed service mounts into untyped `Binds`
when creating containers, use the new `Mounts` API which is a 1-1
mapping between service mounts and container mounts.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 821aeb6a6f72f070ae045cb7813759cbbaba7bda
Component: engine
2016-11-22 13:23:51 -05:00
c148947fe6 fix a few golint errors
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Upstream-commit: 9c559e6d0b7190b4698de59e692a047beba017fd
Component: engine
2016-11-18 18:32:02 -08:00
9d6cdfc19f fix gofmt in master
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Upstream-commit: 9f348d5625996faf7a0855b8eb52cdd4def3958e
Component: engine
2016-11-18 15:20:19 -08:00
a43886ca90 Merge pull request #28538 from yongtang/11162016-Log-Logf-fix
Fix several issues with `go vet` and `gofmt -s`
Upstream-commit: 22dccaf2d6503e141e48ae3d9f3edc7ace946bbd
Component: engine
2016-11-17 15:21:22 -05:00
dcce853abc Fix several issues with go vet and go fmt
For some reason, `go vet` and `go fmt` validate does not capture
several issues.

The following was the output of `go vet`:
```
ubuntu@ubuntu:~/docker$ go vet ./... 2>&1 | grep -v ^vendor | grep -v '^exit status 1$'
cli/command/formatter/container_test.go:393: possible formatting directive in Log call
volume/volume_test.go:257: arg mp.RW for printf verb %s of wrong type: bool
```

The following was the output of `go fmt -s`:
```
ubuntu@ubuntu:~/docker$ gofmt -s -l . | grep -v ^vendor
cli/command/stack/list.go
daemon/commit.go
```

Fixed above issues with `go vet` and `go fmt -s`

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: ace786e9d517777473bd431e65d6c464d82e4f65
Component: engine
2016-11-17 06:31:28 -08:00
2bd4fbcf97 fix bugs 'fatal error: concurrent map read and map write' to change VolumeStore.globalLock type from Mutex to RWMutex, and add globalLock.RLock() for the read of names, refs, labels and options in VolumeStore
Signed-off-by: He Xin <he_xinworld@126.com>
Upstream-commit: 19bd1cee236b85d2e24fdf49d6181edb7e1f7f17
Component: engine
2016-11-17 10:48:19 +08:00
b92b18a87d Merge pull request #27985 from muayyad-alsadi/17734-better-message-for-host-volumes
fixes #17734, clear message for host volumes not starting with /
Upstream-commit: b06dc994f683fb774be2cfe70d76feb0f684c70e
Component: engine
2016-11-14 14:21:17 -08:00
3b746165af remove "starting with /"
Signed-off-by: Muayyad Alsadi <alsadi@gmail.com>
Upstream-commit: 2d3df91436a096e17214fc56aee4968c3fe598de
Component: engine
2016-11-14 16:51:29 +02:00
9e9974619f Fix a comment error
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
Upstream-commit: 19e2c9177a111758e304ad9dbd0835cddbd840ab
Component: engine
2016-11-14 09:55:27 +08:00
1689aa276d Fix uneccessary calls to volume.Unmount()
Fixes #22564

When an error occurs on mount, there should not be any call later to
unmount. This can throw off refcounting in the underlying driver
unexpectedly.

Consider these two cases:

```
$ docker run -v foo:/bar busybox true
```

```
$ docker run -v foo:/bar -w /foo busybox true
```

In the first case, if mounting `foo` fails, the volume driver will not
get a call to unmount (this is the incorrect behavior).

In the second case, the volume driver will not get a call to unmount
(correct behavior).

This occurs because in the first case, `/bar` does not exist in the
container, and as such there is no call to `volume.Mount()` during the
`create` phase. It will error out during the `start` phase.

In the second case `/bar` is created before dealing with the volume
because of the `-w`. Because of this, when the volume is being setup
docker will try to copy the image path contents in the volume, in which
case it will attempt to mount the volume and fail. This happens during
the `create` phase. This makes it so the container will not be created
(or at least fully created) and the user gets the error on `create`
instead of `start`. The error handling is different in these two phases.

Changed to only send `unmount` if the volume is mounted.

While investigating the cause of the reported issue I found some odd
behavior in unmount calls so I've cleaned those up a bit here as well.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 9a2d0bc3adc0c21c82cd1974be45ea0449f9f224
Component: engine
2016-11-10 14:04:08 -05:00
d1564f5e36 Merge pull request #27329 from dattatrayakumbhar04/26639_nfs_volume_with_hostname
#26639: Local NFS volumes do not resolve hostnames
Upstream-commit: 5020905e9d1a365bf6f23c432a09500fd80ca112
Component: engine
2016-11-09 13:46:56 +00:00
0ae7380acd #26639: Local NFS volumes do not resolve hostnames
Signed-off-by: dattatrayakumbhar04 <dattatraya.kumbhar@gslab.com>
Upstream-commit: 668fa8aff21d18355a4baa7318eec1ec5eccf1cf
Component: engine
2016-11-08 08:26:53 +00:00
e967a9b4b9 api: fix ReadOnly support for tmpfs
For `--mount type=tmpfs,target=/foo,readonly`, the `readonly` flag was just ignored.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Upstream-commit: 3e3d3c8086237f4938e3e13561dbc1d41b5c617b
Component: engine
2016-11-08 06:49:17 +00:00
6fb90ed484 Add functional support for Docker sub commands on Solaris
Signed-off-by: Amit Krishnan <krish.amit@gmail.com>

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 934328d8ea650bf8a9c3c719999ce2a1f5dd5df6
Component: engine
2016-11-07 09:06:34 -08:00
ed09e04a52 Merge pull request #27164 from cpuguy83/carry_24205
Fix volume creates blocked by stale cache entries
Upstream-commit: cf55397e130e6ab04ad723ef014cf49a3b62998e
Component: engine
2016-11-03 10:28:13 -07:00