Commit graph

37000 commits

Author SHA1 Message Date
Kir Kolyshkin
af433dd200 layer: protect from same-name races
As pointed out by Tonis, there's a race between ReleaseRWLayer()
and GetRWLayer():

```
----- goroutine 1 -----               ----- goroutine 2 -----
ReleaseRWLayer()
  m := ls.mounts[l.Name()]
  ...
  m.deleteReference(l)
  m.hasReferences()
  ...                                 GetRWLayer()
  ...                                   mount := ls.mounts[id]
  ls.driver.Remove(m.mountID)
  ls.store.RemoveMount(m.name)          return mount.getReference()
  delete(ls.mounts, m.Name())
-----------------------               -----------------------
```

When something like this happens, GetRWLayer will return
an RWLayer without a storage. Oops.

There might be more races like this, and it seems the best
solution is to lock by layer id/name by using pkg/locker.

With this in place, name collision could not happen, so remove
the part of previous commit that protected against it in
CreateRWLayer (temporary nil assigmment and associated rollback).

So, now we have
* layerStore.mountL sync.Mutex to protect layerStore.mount map[]
  (against concurrent access);
* mountedLayer's embedded `sync.Mutex` to protect its references map[];
* layerStore.layerL (which I haven't touched);
* per-id locker, to avoid name conflicts and concurrent operations
  on the same rw layer.

The whole rig seems to look more readable now (mutexes use is
straightforward, no nested locks).

Reported-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-05-21 10:54:28 -07:00
Kir Kolyshkin
b4e9b50765 layer/CreateRWLayerByGraphID: remove
This is an additon to commit 1fea38856a ("Remove v1.10 migrator")
aka PR #38265. Since that one, CreateRWLayerByGraphID() is not
used anywhere, so let's drop it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-05-21 10:54:28 -07:00
Akihiro Suda
b4247b433e builder-next: support DOCKER_RAMDISK
For https://github.com/kubernetes/minikube/issues/4143

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2019-05-22 00:39:03 +09:00
Dominic Tubach
fa6f63e79b API: Set format of body parameter in operation PutContainerArchive to "binary"
Signed-off-by: Dominic Tubach <dominic.tubach@to.com>
2019-05-21 17:09:18 +02:00
Yong Tang
cae3c91d6b
Merge pull request #39215 from ddebroy/windows-tag
Consider WINDOWS_BASE_IMAGE_TAG override when setting Windows base image
2019-05-21 07:04:20 -07:00
Sebastiaan van Stijn
a66ddd8ab8
bump libnetwork 5ac07abef4eee176423fdc1b870d435258e2d381
full diff: 9ff9b57c34...5ac07abef4

brings in:

- docker/libnetwork#2376 Forcing a nil IP specified in PortBindings to IPv4zero (0.0.0.0)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-05-21 14:46:18 +02:00
Sebastiaan van Stijn
850b5d9e9c
Merge pull request #39243 from kolyshkin/TestSearchCmdOptions
int-cli/TestSearchCmdOptions: fix
2019-05-21 12:58:16 +02:00
Kir Kolyshkin
4f80a1953d int-cli/TestSearchCmdOptions: fail earlier
Sometimes this test fails (allegedly due to problems with Docker Hub),
but it fails later than it should, for example:

> 01:20:34.845 assertion failed: expression is false: strings.Count(outSearchCmdStars, "[OK]") <= strings.Count(outSearchCmd, "[OK]"): The quantity of images with stars should be less than that of all images: <...>

This, with non-empty list of images following, means that the initial
`docker search busybox` command returned not enough results. So, add
a check that `docker search busybox` returns something.

While at it,
 * raise the number of stars to 10;
 * simplify check for number of lines (no need to count [OK]'s);
 * improve error message.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-05-21 01:55:18 -07:00
Brian Goff
9808f6036a
Merge pull request #39212 from yyb196/devno
bugfix: fetch the right device number which great than 255
2019-05-20 10:43:03 -07:00
Brian Goff
03a03c6c32
Merge pull request #39190 from ollypom/swarmnanocpu
Switch Swarm Mode services to NanoCpu
2019-05-20 10:14:07 -07:00
Sebastiaan van Stijn
19008faf03
Merge pull request #38992 from kolyshkin/mnt
pkg/mount: optimizations
2019-05-20 14:12:42 +02:00
Sebastiaan van Stijn
77a42751d2
Merge pull request #39211 from tonistiigi/pull-progress-fix
builder-next: call stopprogress on download error
2019-05-20 09:00:20 +02:00
Sebastiaan van Stijn
bc3826806c
Merge pull request #39226 from jim-docker/EDGE374_TestDaemonNoSpaceLeftOnDeviceError
Fix TestDaemonNoSpaceLeftOnDeviceError for arm architecture
2019-05-17 17:16:55 +02:00
Jim Ehrismann
d7de1a8b9f explicitly set filesystem type for mount to avoid 'invalid argument' error on arm
Signed-off-by: Jim Ehrismann <jim.ehrismann@docker.com>
2019-05-16 14:46:41 -04:00
frankyang
b9f31912de bugfix: fetch the right device number which great than 255
Signed-off-by: frankyang <yyb196@gmail.com>
2019-05-16 15:32:59 +08:00
Brian Goff
34b56728ed
Merge pull request #39222 from AkihiroSuda/rootless-fix-kill
rootless: fix killing daemon
2019-05-15 11:57:22 -07:00
Akihiro Suda
34cc5c24d0 dockerd-rootless.sh: use exec
Killing the shell script process does not kill the forked process.

This commit switches to `exec` so that the executed process can be
easily killed.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2019-05-15 20:52:59 +09:00
Akihiro Suda
00c92a6719 bump up rootlesskit to v0.4.1
Now the child process is killed when the parent dies (rootless-containers/rootlesskit#66)

e92d5e7...27a0c7a

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2019-05-15 20:51:48 +09:00
Brian Goff
f4b9142210
Merge pull request #39208 from thaJeztah/bump_api_version
Bump API version to v1.41
2019-05-14 20:02:39 -07:00
Brian Goff
de6df469f1
Merge pull request #39206 from ijc/no-retry-ping-on-errconn
client: do not fallback to GET if HEAD on _ping fail to connect
2019-05-14 19:34:40 -07:00
Deep Debroy
15419d7ba0 Consider WINDOWS_BASE_IMAGE_TAG override when setting Windows base image for tests
Signed-off-by: Deep Debroy <ddebroy@docker.com>
2019-05-14 13:27:18 -07:00
Sebastiaan van Stijn
8861376202
Merge pull request #39210 from tonistiigi/update-buildkit
vendor: update buildkit to f238f1ef
2019-05-14 13:04:53 -07:00
Tibor Vass
52744d4330
Merge pull request #39062 from thaJeztah/bump_grpc_1.20.0
bump google.golang.org/grpc v1.20.1
2019-05-14 11:56:59 -07:00
Tonis Tiigi
91a57f3e7f builder-next: call stopprogress on download error
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-05-13 17:01:13 -07:00
Tonis Tiigi
a3cbd53ed2 vendor: update buildkit to f238f1ef
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-05-13 16:50:01 -07:00
Sebastiaan van Stijn
28ad54d84f
bump google.golang.org/grpc v1.20.1
full diff: https://github.com/grpc/grpc-go/compare/v1.12.2...v1.20.1

includes  grpc/grpc-go#2695 transport: do not close channel that can lead to panic
addresses moby/moby#39053

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-05-13 15:06:34 -07:00
Sebastiaan van Stijn
7bacd1d6dc
Move CgroupnsMode feature to API v1.41
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-05-13 15:04:28 -07:00
Sebastiaan van Stijn
771fc7e7f8
Bump API version to v1.41
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-05-13 14:55:20 -07:00
Ian Campbell
8c8457b0f2 client: do not fallback to GET if HEAD on _ping fail to connect
When we see an `ECONNREFUSED` (or equivalent) from an attempted `HEAD` on the
`/_ping` endpoint there is no point in trying again with `GET` since the server
is not responding/available at all.

Once vendored into the cli this will partially mitigate https://github.com/docker/cli/issues/1739
("Docker commands take 1 minute to timeout if context endpoint is unreachable")
by cutting the effective timeout in half.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-05-13 13:48:17 +01:00
Yong Tang
3042254a87
Merge pull request #38377 from rgulewich/38332-cgroup-ns
Start containers in their own cgroup namespaces
2019-05-11 20:18:31 -07:00
Stig Larsson
6205fcf60d Correct copy paste mistage in pkg/mount/mountinfo_freebsd.go that caused compile errors.
Signed-off-by: Stig Larsson <stig@larsson.dev>
2019-05-11 14:04:02 +00:00
Sebastiaan van Stijn
3998dffb80
Merge pull request #39197 from djsweet/log-daemon-exit-before-tests-finish
Ensure all integration daemon logging happens before test exit
2019-05-10 19:01:11 -07:00
Tibor Vass
df43bc329e
Merge pull request #39152 from thaJeztah/bump_buildkit
Bump buildkit v0.5.0
2019-05-10 16:22:48 -07:00
Tibor Vass
ee399522df
Merge pull request #39143 from thaJeztah/bump_runc_1.0.0-rc.8
Bump runc 1.0.0-rc8, opencontainers/selinux v1.2.2
2019-05-09 15:28:22 -07:00
Kirill Kolyshkin
a4d69938ac
Merge pull request #39135 from kolyshkin/layer-mount-lock
Lessen mount lock contention in layer store
2019-05-09 11:50:39 -07:00
Xinfeng Liu
05250a4f00 layer: optimize layerStore mountL
Goroutine stack analisys shown some lock contention
while doing massively (100 instances of `docker rm`)
parallel image removal, with many goroutines waiting
for the mountL mutex. Optimize it.

With this commit, the above operation is about 3x
faster, with no noticeable change to container
creation times (tested on aufs and overlay2).

kolyshkin@:
- squashed commits
- added description
- protected CreateRWLayer against name collisions by
temporary assiging nil to ls.mounts[name], and treating
nil as "non-existent" in all the other functions.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-05-09 11:05:16 -07:00
Daniel Sweet
7546322e99 Ensure all integration daemon logging happens before test exit
As of Go 1.12, the `testing` package panics if a goroutine logs to a
`testing.T` after the relevant test has completed. This was not
documented as a change at all; see the commit
95d06ab6c982f58b127b14a52c3325acf0bd3926 in the Go repository for the
relevant change.

At any point in the integration tests, tests could panic with the
message "Log in goroutine after TEST_FUNCTION has completed". This was
exacerbated by less direct logging I/O, e.g. running `make test` with
its output piped instead of attached to a TTY.

The most common cause of panics was that there was a race condition
between an exit logging goroutine and the `StopWithError` method:
`StopWithError` could return, causing the calling test method to return,
causing the `testing.T` to be marked as finished, before the goroutine
could log that the test daemon had exited. The fix is simple: capture
the result of `cmd.Wait()`, _then_ log, _then_ send the captured
result over the `Wait` channel. This ensures that the message is
logged before `StopWithError` can return, blocking the test method
so that the target `testing.T` is not marked as finished.

Signed-off-by: Daniel Sweet <danieljsweet@icloud.com>
2019-05-09 13:23:43 -04:00
Sebastiaan van Stijn
994007dd89
Merge pull request #39174 from arkodg/remove-stale-lb-ep
Remove a network during task SHUTDOWN instead of REMOVE
2019-05-08 17:42:34 -07:00
Akihiro Suda
69c5ea328d
Merge pull request #39179 from tao12345666333/bump-golang-1.12.5
Bump Golang 1.12.5
2019-05-09 07:35:08 +09:00
Olly Pomeroy
8a60a1e14a Switch swarmmode services to NanoCpu
Today `$ docker service create --limit-cpu` configures a containers
`CpuPeriod` and `CpuQuota` variables, this commit switches this to
configure a containers `NanoCpu` variable instead.

Signed-off-by: Olly Pomeroy <olly@docker.com>
2019-05-08 14:04:24 +00:00
Yong Tang
0748c6ea39
Merge pull request #39158 from yashmurty/remove-disk-quota
Remove HostConfig.DiskQouta field.
2019-05-07 21:40:58 -04:00
Brian Goff
35a4de289e
Merge pull request #39183 from tonistiigi/gcr-token-fix
builder-next: fix gcr workaround token cache
2019-05-07 15:43:04 -07:00
Tonis Tiigi
cfce0acd33 builder-next: fix gcr workaround token cache
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-05-07 10:33:04 -07:00
Rob Gulewich
072400fc4b Make cgroup namespaces configurable
This adds both a daemon-wide flag and a container creation property:
- Set the `CgroupnsMode: "host|private"` HostConfig property at
  container creation time to control what cgroup namespace the container
  is created in
- Set the `--default-cgroupns-mode=host|private` daemon flag to control
  what cgroup namespace containers are created in by default
- Set the default if the daemon flag is unset to "host", for backward
  compatibility
- Default to CgroupnsMode: "host" for client versions < 1.40

Signed-off-by: Rob Gulewich <rgulewich@netflix.com>
2019-05-07 10:22:16 -07:00
Rob Gulewich
256eb04d69 Start containers in their own cgroup namespaces
This is enabled for all containers that are not run with --privileged,
if the kernel supports it.

Fixes #38332

Signed-off-by: Rob Gulewich <rgulewich@netflix.com>
2019-05-07 10:22:16 -07:00
Arko Dasgupta
680d0ba4ab Remove a network during task SHUTDOWN instead of REMOVE to
make sure the LB sandbox is removed when a service is updated
with a --network-rm option

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2019-05-06 20:26:59 -07:00
Jintao Zhang
3a4c5b6a0d Bump Golang 1.12.5
Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
2019-05-07 11:19:39 +08:00
Sebastiaan van Stijn
b20a14b546
Merge pull request #39175 from arkodg/patch-1
Update .DEREK.yml
2019-05-06 14:10:59 -07:00
Arko Dasgupta
343413425c Update .DEREK.yml
Requesting rights to rebuild PRs

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2019-05-06 13:27:04 -07:00
Kir Kolyshkin
f73b5cb4e8 layer: protect mountedLayer.references
Add a mutex to protect concurrent access to mountedLayer.references map.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-05-06 10:49:59 -07:00