1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
Moby Project - a collaborative project for the container ecosystem to assemble container-based systems
Find a file
Sebastiaan van Stijn cb7b329911
daemon: fix daemon.Shutdown, daemon.Cleanup not cleaning up overlay2 mounts
While working on deprecation of the `aufs` and `overlay` storage-drivers, the
`TestCleanupMounts` had to be updated, as it was currently using `aufs` for
testing. When rewriting the test to use `overlay2` instead (using an updated
`mountsFixture`), I found out that the test was failing, and it appears that
only `overlay`, but not `overlay2` was taken into account.

These cleanup functions were added in 05cc737f54,
but at the time the `overlay2` storage driver was not yet implemented;
05cc737f54/daemon/graphdriver

This omission was likely missed in 23e5c94cfb,
because the original implementation re-used the `overlay` storage driver, but
later on it was decided to make `overlay2` a separate storage driver.

As a result of the above, `daemon.cleanupMountsByID()` would ignore any `overlay2`
mounts during `daemon.Shutdown()` and `daemon.Cleanup()`.

This patch:

- Adds a new `mountsFixtureOverlay2` with example mounts for `overlay2`
- Rewrites the tests to use `gotest.tools` for more informative output on failures.
- Adds the missing regex patterns to `daemon/getCleanPatterns()`. The patterns
  are added at the start of the list to allow for the fasted match (`overlay2`
  is the default for most setups, and the code is iterating over possible
  options).

As a follow-up, we could consider adding additional fixtures for different
storage drivers.

Before the fix is applied:

    go test -v -run TestCleanupMounts ./daemon/
    === RUN   TestCleanupMounts
    === RUN   TestCleanupMounts/aufs
    === RUN   TestCleanupMounts/overlay2
    daemon_linux_test.go:135: assertion failed: 0 (unmounted int) != 1 (int): Expected to unmount the shm (and the shm only)
    --- FAIL: TestCleanupMounts (0.01s)
    --- PASS: TestCleanupMounts/aufs (0.00s)
    --- FAIL: TestCleanupMounts/overlay2 (0.01s)
    === RUN   TestCleanupMountsByID
    === RUN   TestCleanupMountsByID/aufs
    === RUN   TestCleanupMountsByID/overlay2
    daemon_linux_test.go:171: assertion failed: 0 (unmounted int) != 1 (int): Expected to unmount the root (and that only)
    --- FAIL: TestCleanupMountsByID (0.00s)
    --- PASS: TestCleanupMountsByID/aufs (0.00s)
    --- FAIL: TestCleanupMountsByID/overlay2 (0.00s)
    FAIL
    FAIL	github.com/docker/docker/daemon	0.054s
    FAIL

With the fix applied:

    go test -v -run TestCleanupMounts ./daemon/
    === RUN   TestCleanupMounts
    === RUN   TestCleanupMounts/aufs
    === RUN   TestCleanupMounts/overlay2
    --- PASS: TestCleanupMounts (0.00s)
    --- PASS: TestCleanupMounts/aufs (0.00s)
    --- PASS: TestCleanupMounts/overlay2 (0.00s)
    === RUN   TestCleanupMountsByID
    === RUN   TestCleanupMountsByID/aufs
    === RUN   TestCleanupMountsByID/overlay2
    --- PASS: TestCleanupMountsByID (0.00s)
    --- PASS: TestCleanupMountsByID/aufs (0.00s)
    --- PASS: TestCleanupMountsByID/overlay2 (0.00s)
    PASS
    ok  	github.com/docker/docker/daemon	0.042s

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-05-29 16:28:13 +02:00
.github Merge pull request #43479 from crazy-max/gha-win-tests 2022-05-23 11:54:32 +02:00
api Annotate some swagger documented types as int64 2022-05-23 21:10:07 +02:00
builder builder: fix empty reference 2022-05-28 21:23:30 +02:00
cli add instructions to generate events message table bin 2022-04-14 19:52:36 +02:00
client daemon/linux: Set console size on creation 2022-05-19 07:57:27 +02:00
cmd Add Swarm cluster volume supports 2022-05-13 00:55:44 +02:00
container container: StopSignal(): return syscall.Signal 2022-05-05 00:53:53 +02:00
contrib Merge pull request #43275 from kponichtera/43274-delve-debugger 2022-05-10 18:34:45 +02:00
daemon daemon: fix daemon.Shutdown, daemon.Cleanup not cleaning up overlay2 mounts 2022-05-29 16:28:13 +02:00
distribution Remove unused distribution/metadata/V1IDService 2022-05-10 23:39:22 +02:00
dockerversion use go-winres for windows build and cleanup autogen and winresources 2022-04-14 19:52:36 +02:00
docs Annotate some swagger documented types as int64 2022-05-23 21:10:07 +02:00
errdefs errdefs: move GetHTTPErrorStatusCode to api/server/httpstatus 2022-03-21 12:22:39 +01:00
hack Merge pull request #43479 from crazy-max/gha-win-tests 2022-05-23 11:54:32 +02:00
image Remove unused image/v1 code 2022-05-10 23:45:03 +02:00
integration Fix validation of IpcMode, PidMode, UTSMode, CgroupnsMode 2022-05-25 17:41:51 +02:00
integration-cli integration-cli: TestRemoveContainerAfterLiveRestore use overlay2 2022-05-24 17:28:14 +02:00
internal/test/suite integration-cli: move each test suite to its own TestX testing function 2019-09-18 18:26:36 +00:00
layer Merge pull request #43366 from corhere/finish-identitymapping-refactor 2022-03-25 14:51:05 +01:00
libcontainerd daemon: daemon.ContainerKill() accept stop-signal as string 2022-05-05 11:27:47 +02:00
libnetwork Set ExternalPortReserved for dummy proxy 2022-05-25 07:12:43 -07:00
oci oci: inheritable capability set should be empty 2022-02-08 14:33:44 -08:00
opts opts: ParseTCPAddr(): extract parsing logic, consistent errors 2022-05-01 19:53:40 +02:00
pkg Fix constant WARNING: No swap limit support on cgroup v2 hosts 2022-05-27 10:51:54 +09:00
plugin Add Swarm cluster volume supports 2022-05-13 00:55:44 +02:00
profiles all: use unix.ByteSliceToString for utsname fields 2022-05-18 17:13:20 -07:00
project Remove "seccomp" build tag 2022-05-12 14:48:35 -07:00
quota refactor: move from io/ioutil to io and os package 2021-08-27 14:56:57 +08:00
reference remove unneeded "digest" alias for "go-digest" 2022-03-04 14:49:42 +01:00
registry all: replace strings.Replace with strings.ReplaceAll 2022-05-09 19:45:40 +08:00
reports Fix typos 2018-05-16 09:15:43 +08:00
restartmanager unconvert: remove unnescessary conversions 2019-09-18 12:57:33 +02:00
rootless rootless: remove redundant sync.Once 2022-04-25 13:53:32 +02:00
runconfig runconfig: ContainerDecoder(): fix handling of invalid JSON 2022-04-11 21:44:45 +02:00
testutil integration-cli: TestRestartContainer is flaky on GitHub Runner 2022-05-19 21:19:10 +02:00
vendor vendor: github.com/containerd/cgroups v1.0.4 2022-05-27 10:49:24 +09:00
volume Merge pull request #43597 from shoeffner/43596-mask-cifs-passwords 2022-05-19 22:52:26 +02:00
.DEREK.yml Update .DEREK.yml 2019-05-06 13:27:04 -07:00
.dockerignore use go-winres for cross to create Windows resources 2022-04-14 19:52:35 +02:00
.gitattributes chore: fix linguist for Dockerfile 2022-04-27 06:38:41 +02:00
.gitignore use go-winres for windows build and cleanup autogen and winresources 2022-04-14 19:52:36 +02:00
.mailmap maintainers: update metadata for samuelkarp 2022-04-08 14:27:34 -07:00
AUTHORS maintainers: update metadata for samuelkarp 2022-04-08 14:27:34 -07:00
CHANGELOG.md changelog: fix incorrectly named libnetwork label 2021-05-31 15:27:46 +02:00
codecov.yml ci(windows): upload coverage to codecov 2022-05-20 10:12:10 +02:00
CONTRIBUTING.md Removed the slack archives 2022-01-13 18:30:45 +01:00
docker-bake.hcl ci: add cross job in ci workflow 2022-04-10 21:03:54 +02:00
Dockerfile update gotestsum to v1.8.1 2022-05-27 17:59:58 +02:00
Dockerfile.e2e update golang to 1.18.2 2022-05-11 13:08:25 +02:00
Dockerfile.simple update golang to 1.18.2 2022-05-11 13:08:25 +02:00
Dockerfile.windows update gotestsum to v1.8.1 2022-05-27 17:59:58 +02:00
Jenkinsfile Jenkinsfile: add workaround for CVE-2022-24765 2022-04-13 15:58:55 +02:00
LICENSE Update LICENSE 2018-09-12 14:27:53 +01:00
MAINTAINERS maintainers: update metadata for samuelkarp 2022-04-08 14:27:34 -07:00
Makefile Merge pull request #43275 from kponichtera/43274-delve-debugger 2022-05-10 18:34:45 +02:00
NOTICE switch kr/pty to creack/pty v1.1.7 2019-07-29 16:59:08 -07:00
README.md Add "Lego set" back in README.md 2017-10-10 14:10:39 +00:00
ROADMAP.md Fix some typos in ROADMAP.md 2019-01-25 14:27:13 +08:00
SECURITY.md Update SECURITY.md to have an option to keep name anonymous if requested. 2019-06-18 16:37:16 +00:00
TESTING.md TESTING.md: note that integration-cli is deprecated 2020-12-18 07:51:46 +01:00
vendor.mod vendor: github.com/containerd/cgroups v1.0.4 2022-05-27 10:49:24 +09:00
vendor.sum vendor: github.com/containerd/cgroups v1.0.4 2022-05-27 10:49:24 +09:00
VENDORING.md fix the bare url and the Summary of http://semver.org 2017-01-17 16:20:11 +08:00

The Moby Project

Moby Project logo

Moby is an open-source project created by Docker to enable and accelerate software containerization.

It provides a "Lego set" of toolkit components, the framework for assembling them into custom container-based systems, and a place for all container enthusiasts and professionals to experiment and exchange ideas. Components include container build tools, a container registry, orchestration tools, a runtime and more, and these can be used as building blocks in conjunction with other tools and projects.

Principles

Moby is an open project guided by strong principles, aiming to be modular, flexible and without too strong an opinion on user experience. It is open to the community to help set its direction.

  • Modular: the project includes lots of components that have well-defined functions and APIs that work together.
  • Batteries included but swappable: Moby includes enough components to build fully featured container system, but its modular architecture ensures that most of the components can be swapped by different implementations.
  • Usable security: Moby provides secure defaults without compromising usability.
  • Developer focused: The APIs are intended to be functional and useful to build powerful tools. They are not necessarily intended as end user tools but as components aimed at developers. Documentation and UX is aimed at developers not end users.

Audience

The Moby Project is intended for engineers, integrators and enthusiasts looking to modify, hack, fix, experiment, invent and build systems based on containers. It is not for people looking for a commercially supported system, but for people who want to work and learn with open source code.

Relationship with Docker

The components and tools in the Moby Project are initially the open source components that Docker and the community have built for the Docker Project. New projects can be added if they fit with the community goals. Docker is committed to using Moby as the upstream for the Docker Product. However, other projects are also encouraged to use Moby as an upstream, and to reuse the components in diverse ways, and all these uses will be treated in the same way. External maintainers and contributors are welcomed.

The Moby project is not intended as a location for support or feature requests for Docker products, but as a place for contributors to work on open source code, fix bugs, and make the code more useful. The releases are supported by the maintainers, community and users, on a best efforts basis only, and are not intended for customers who want enterprise or commercial support; Docker EE is the appropriate product for these use cases.


Legal

Brought to you courtesy of our legal counsel. For more context, please see the NOTICE document in this repo.

Use and transfer of Moby may be subject to certain restrictions by the United States and other governments.

It is your responsibility to ensure that your use and/or transfer does not violate applicable laws.

For more information, please see https://www.bis.doc.gov

Licensing

Moby is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.