summaryrefslogtreecommitdiff
path: root/plugin/backend_linux.go
Commit message (Collapse)AuthorAgeFilesLines
* fixing consistent aliases for OCI spec importsJeyanthinath Muthuram2023-05-081-14/+14
| | | | Signed-off-by: Jeyanthinath Muthuram <jeyanthinath10@gmail.com>
* Use GetBoolOrDefault to remove duplicated invalidFilter usagesPaweł Gronowski2023-01-261-4/+7
| | | | | | | The pattern of parsing bool was repeated across multiple files and caused the duplication of the invalidFilter error helper. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* plugin: fix empty-lines (revive)Sebastiaan van Stijn2022-09-281-1/+0
| | | | | | | | plugin/v2/settable_test.go:24:29: empty-lines: extra empty line at the end of a block (revive) plugin/manager_linux.go:96:6: empty-lines: extra empty line at the end of a block (revive) plugin/backend_linux.go:373:16: empty-lines: extra empty line at the start of a block (revive) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* plugin: use types/registry.AuthConfigSebastiaan van Stijn2022-07-291-7/+8
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* remove unneeded "digest" alias for "go-digest"Sebastiaan van Stijn2022-03-041-1/+1
| | | | | | | | I think this was there for historic reasons (may have been goimports expected this, and we used to have a linter that wanted it), but it's not needed, so let's remove it (to make my IDE less complaining about unneeded aliases). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* pkg/system: move EnsureRemoveAll() to pkg/containerfsSebastiaan van Stijn2022-03-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pkg/system historically has been a bit of a kitchen-sink of things that were somewhat "system" related, but didn't have a good place for. EnsureRemoveAll() is one of those utilities. EnsureRemoveAll() is used to both unmount and remove a path, for which it depends on both github.com/moby/sys/mount, which in turn depends on github.com/moby/sys/mountinfo. pkg/system is imported in the CLI, but neither EnsureRemoveAll(), nor any of its moby/sys dependencies are used on the client side, so let's move this function somewhere else, to remove those dependencies from the CLI. I looked for plausible locations that were related; it's used in: - daemon - daemon/graphdriver/XXX/ - plugin I considered moving it into a (e.g.) "utils" package within graphdriver (but not a huge fan of "utils" packages), and given that it felt (mostly) related to cleaning up container filesystems, I decided to move it there. Some things to follow-up on after this: - Verify if this function is still needed (it feels a bit like a big hammer in a "YOLO, let's try some things just in case it fails") - Perhaps it should be integrated in `containerfs.Remove()` (so that it's used automatically) - Look if there's other implementations (and if they should be consolidated), although (e.g.) the one in containerd is a copy of ours: https://github.com/containerd/containerd/blob/v1.5.9/pkg/cri/server/helpers_linux.go#L200 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* refactor: move from io/ioutil to io and os packageEng Zer Jun2021-08-271-6/+5
| | | | | | | | The io/ioutil package has been deprecated in Go 1.16. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* vendor: github.com/containerd/containerd v1.5.2Sebastiaan van Stijn2021-06-041-2/+2
| | | | | | full diff: https://github.com/containerd/containerd/compare/19ee068f93c91f7b9b2a858457f1af2cabc7bc06...v1.5.2 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Use docker media type for plugin layersBrian Goff2021-04-051-1/+1
| | | | | | | | This was changed as part of a refactor to use containerd dist code. The problem is the OCI media types are not compatible with older versions of Docker. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Use containerd dist libs for plugin pull/pullBrian Goff2020-04-021-297/+249
| | | | | | | | | | | | This removes the use of the old distribution code in the plugin packages and replaces it with containerd libraries for plugin pushes and pulls. Additionally it uses a content store from containerd which seems like it's compatible with the old "basicBlobStore" in the plugin package. This is being used locally isntead of through the containerd client for now. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Really switch to moby/sys/mount*Kir Kolyshkin2020-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | Switch to moby/sys/mount and mountinfo. Keep the pkg/mount for potential outside users. This commit was generated by the following bash script: ``` set -e -u -o pipefail for file in $(git grep -l 'docker/docker/pkg/mount"' | grep -v ^pkg/mount); do sed -i -e 's#/docker/docker/pkg/mount"#/moby/sys/mount"#' \ -e 's#mount\.\(GetMounts\|Mounted\|Info\|[A-Za-z]*Filter\)#mountinfo.\1#g' \ $file goimports -w $file done ``` Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
* goimports: fix importsSebastiaan van Stijn2019-09-181-2/+2
| | | | | | | Format the source according to latest goimports. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Various code-cleanupSebastiaan van Stijn2018-05-231-1/+1
| | | | | | remove unnescessary import aliases, brackets, and so on. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Switch from x/net/context -> contextKir Kolyshkin2018-04-231-1/+1
| | | | | | | | | | | Since Go 1.7, context is a standard package. Since Go 1.9, everything that is provided by "x/net/context" is a couple of type aliases to types in "context". Many vendored packages still use x/net/context, so vendor entry remains for now. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
* Windows: Block pulling uplevel imagesJohn Howard2018-02-261-2/+13
| | | | Signed-off-by: John Howard <jhoward@microsoft.com>
* Add canonical import commentDaniel Nephin2018-02-051-1/+1
| | | | Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Merge pull request #34372 from cpuguy83/more_error_handling_for_pluginrmVincent Demeester2018-01-251-6/+34
|\ | | | | Ignore exist/not-exist errors on plugin remove
| * Ignore exist/not-exist errors on plugin removeBrian Goff2018-01-251-6/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During a plugin remove, docker performs an `os.Rename` to move the plugin data dir to a new location before removing to acheive an atomic removal. `os.Rename` can return either a `NotExist` error if the source path doesn't exist, or an `Exist` error if the target path already exists. Both these cases can happen when there is an error on the final `os.Remove` call, which is common on older kernels (`device or resource busy`). When calling rename, we can safely ignore these error types and proceed to try and remove the plugin. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* | LCOW: Refactor to multiple layer-stores based on feedbackJohn Howard2018-01-181-2/+4
| | | | | | | | Signed-off-by: John Howard <jhoward@microsoft.com>
* | LCOW: Re-coalesce storesJohn Howard2018-01-181-2/+2
| | | | | | | | | | | | | | | | | | | | 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.
* | Move api/errdefs to errdefsBrian Goff2018-01-111-1/+1
| | | | | | | | Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* | Add helpers to create errdef errorsBrian Goff2018-01-111-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of having to create a bunch of custom error types that are doing nothing but wrapping another error in sub-packages, use a common helper to create errors of the requested type. e.g. instead of re-implementing this over and over: ```go type notFoundError struct { cause error } func(e notFoundError) Error() string { return e.cause.Error() } func(e notFoundError) NotFound() {} func(e notFoundError) Cause() error { return e.cause } ``` Packages can instead just do: ``` errdefs.NotFound(err) ``` Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* | Remove redundant build-tagsSebastiaan van Stijn2017-12-181-2/+0
|/ | | | | | | | Files that are suffixed with `_linux.go` or `_windows.go` are already only built on Linux / Windows, so these build-tags were redundant. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* LCOW: API: Add platform to /images/create and /buildJohn Howard2017-10-061-2/+2
| | | | | | | | | | | | | | | 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.
* Replace uses of filters.Include() with filters.Contains()Sebastiaan van Stijn2017-09-261-2/+2
| | | | | | | | | | The `filters.Include()` method was deprecated in favor of `filters.Contains()` in 065118390a3ecaf0dbd2fa752d54d43f8f1e8ec6, but still used in various locations. This patch replaces uses of `filters.Include()` with `filters.Contains()`. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Add deadcode linterDaniel Nephin2017-08-211-17/+1
| | | | Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Remove string checking in API error handlingBrian Goff2017-08-151-17/+16
| | | | | | | | | | | | | | Use strongly typed errors to set HTTP status codes. Error interfaces are defined in the api/errors package and errors returned from controllers are checked against these interfaces. Errors can be wraeped in a pkg/errors.Causer, as long as somewhere in the line of causes one of the interfaces is implemented. The special error interfaces take precedence over Causer, meaning if both Causer and one of the new error interfaces are implemented, the Causer is not traversed. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Update logrus to v1.0.1Derek McGowan2017-07-311-1/+1
| | | | | | Fixes case sensitivity issue Signed-off-by: Derek McGowan <derek@mcgstyle.net>
* Make plugin emit strongly typed, consumable eventsBrian Goff2017-07-061-3/+14
| | | | | | | | | Enables other subsystems to watch actions for a plugin(s). This will be used specifically for implementing plugins on swarm where a swarm controller needs to watch the state of a plugin. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Fix plugin remove dir name after rename.Brian Goff2017-07-041-2/+3
| | | | Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Make plugin removes more resilient to failureBrian Goff2017-06-301-27/+12
| | | | | | | | | | | | | | | | Before this patch, if the plugin's `config.json` is successfully removed but the main plugin state dir could not be removed for some reason (e.g. leaked mount), it will prevent the daemon from being able to be restarted. This patches changes this to atomically remove the plugin such that on daemon restart we can detect that there was an error and re-try. It also changes the logic so that it only logs errors on restore rather than erroring out the daemon. This also removes some code which is now duplicated elsewhere. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* LCOW: Pass platform through into layer storeJohn Howard2017-06-201-2/+2
| | | | Signed-off-by: John Howard <jhoward@microsoft.com>
* authz: eliminate race during plugin removal from middlewareDavid Sheets2017-06-131-8/+1
| | | | | | | | Also, this removes the use of a questionable golang range feature which corrects for mutation of a slice during iteration over that slice. This makes the filter operation easier to read and reason about. Signed-off-by: David Sheets <dsheets@docker.com>
* Don't unmount entire plugin manager tree on removeBrian Goff2017-05-271-2/+2
| | | | | | | This was mistakenly unmounting everything under `plugins/*` instead of just `plugins/<id>/*` anytime a plugin is removed. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Remove unnecessary lineDaehyeok Mun2017-04-261-3/+1
| | | | Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
* Make sure plugin rootfs is unmounted on upgradedBrian Goff2017-04-111-1/+1
| | | | | | | | | | | | In some cases, if a user specifies `-f` when disabling a plugin mounts can still exist on the plugin rootfs. This can cause problems during upgrade where the rootfs is removed and may cause data loss. To resolve this, ensure the rootfs is unmounted before performing an upgrade. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Merge pull request #31930 from anusha-ragunathan/authz-disableAnusha Ragunathan2017-03-221-0/+14
|\ | | | | When authz plugin is disabled, remove from authz middleware chain.
| * When authz plugin is disabled, remove from authz middleware chain.Anusha Ragunathan2017-03-221-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the daemon is configured to run with an authorization-plugin and if the plugin is disabled, the daemon continues to send API requests to the plugin and expect it to respond. But the plugin has been disabled. As a result, all API requests are blocked. Fix this behavior by removing the disabled plugin from the authz middleware chain. Tested using riyaz/authz-no-volume-plugin and observed that after disabling the plugin, API request/response is functional. Fixes #31836 Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
* | Embed DockerVersion in plugin config.Anusha Ragunathan2017-03-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Embedding DockerVersion in plugin config when the plugin is created, enables users to do a docker plugin inspect and know which version the plugin was built on. This is helpful in cases where users are running a new plugin on older docker releases and confused at unexpected behavior. By embedding DockerVersion in the config, we claim that there's no guarantee that if the plugin config's DockerVersion is greater that the version of the docker engine the plugin is executed against, the plugin will work as expected. For example, lets say: - in 17.03, a plugin was released as johndoe/foo:v1 - in 17.05, the plugin uses the new ipchost config setting and author publishes johndoe/foo:v2 In this case, johndoe/foo:v2 was built on 17.05 using ipchost, but is running on docker-engine version 17.03. Since 17.05 > 17.03, there's no guarantee that the plugin will work as expected. Ofcourse, if the plugin did not use newly added config settings (ipchost in this case) in 17.05, it would work fine in 17.03. Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
* | Add pid host supportAnusha Ragunathan2017-03-211-0/+7
| | | | | | | | | | | | | | | | | | | | | | Tested using global-net-plugin-ipc which sets PidHost in config.json. Plugins might need access to host pid namespace. Add support for that. Tested using aragunathan/global-net-plugin-ipc which sets "pidhost" in config.json. Observed using `readlink /proc/self/ns/pid` that plugin and host have the same ns. Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
* | Add support in plugin config for accessing host ipc namespace.Anusha Ragunathan2017-03-211-0/+7
|/ | | | | | | | | | | Plugins might need access to host ipc namespace. A good usecase is a volume plugin running iscsi multipath commands that need access to host kernel locks. Tested with a custom plugin (aragunathan/global-net-plugin-full) that's built with `"ipchost" : true` in config.json. Observed using `readlink /proc/self/ns/ipc` that plugin and host have the same ns. Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
* plugin: check errorsAntonio Murdaca2017-02-151-1/+8
| | | | Signed-off-by: Antonio Murdaca <runcom@redhat.com>
* Use distribution referenceDerek McGowan2017-02-071-13/+13
| | | | | | | | | | | | Remove forked reference package. Use normalized named values everywhere and familiar functions to convert back to familiar strings for UX and storage compatibility. Enforce that the source repository in the distribution metadata is always a normalized string, ignore invalid values which are not. Update distribution tests to use normalized values. Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
* Make propagated mount persist outside rootfsBrian Goff2017-02-031-0/+42
| | | | | | | | | | | | This persists the "propagated mount" for plugins outside the main rootfs. This enables `docker plugin upgrade` to not remove potentially important data during upgrade rather than forcing plugin authors to hard code a host path to persist data to. Also migrates old plugins that have a propagated mount which is in the rootfs on daemon startup. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Add docker plugin upgradeBrian Goff2017-02-031-2/+60
| | | | | | | | | | | | | | | | This allows a plugin to be upgraded without requiring to uninstall/reinstall a plugin. Since plugin resources (e.g. volumes) are tied to a plugin ID, this is important to ensure resources aren't lost. The plugin must be disabled while upgrading (errors out if enabled). This does not add any convenience flags for automatically disabling/re-enabling the plugin during before/after upgrade. Since an upgrade may change requested permissions, the user is required to accept permissions just like `docker plugin install`. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Add `capability` filter to `docker plugin ls`Yong Tang2017-01-271-1/+10
| | | | | | | | | | This fix adds `--filter capability=[volumedriver|authz]` to `docker plugin ls`. The related docs has been updated. An integration test has been added. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Add `--filter enabled=true` for `docker plugin ls`Yong Tang2017-01-261-1/+29
| | | | | | | | | | | | | This fix adds `--filter enabled=true` to `docker plugin ls`, as was specified in 28624. The related API and docs has been updated. An integration test has been added. This fix fixes 28624. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* plugins: rename DeviceCreation to AllowAllDevicesTibor Vass2017-01-101-3/+3
| | | | Signed-off-by: Tibor Vass <tibor@docker.com>
* *: use opencontainers/go-digest packageStephen J Day2017-01-061-3/+3
| | | | | | | | 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>
* Implement content addressability for pluginsTonis Tiigi2016-12-231-163/+462
| | | | | | | | | | | | | | | | | | | | | | | 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>