Commit graph

6299 commits

Author SHA1 Message Date
Sebastiaan van Stijn
b6e373c525
Rename verifyContainerResources to verifyPlatformContainerResources
This validation function is platform-specific; rename it to be
more explicit.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-19 10:24:09 +01:00
Sebastiaan van Stijn
e278678705
Remove unused argument from verifyPlatformContainerSettings
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-19 09:23:09 +01:00
Sebastiaan van Stijn
10c97b9357
Unify logging container validation warnings
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-19 09:15:21 +01:00
Sebastiaan van Stijn
2e23ef5350
Move port-publishing check to linux platform-check
Windows does not have host-mode networking, so on Windows, this
check was a no-op

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-18 22:46:05 +01:00
Sebastiaan van Stijn
57f1305e74
Move "OOM Kill disable" warning to the daemon
Disabling the oom-killer for a container without setting a memory limit
is dangerous, as it can result in the container consuming unlimited memory,
without the kernel being able to kill it. A check for this situation is curently
done in the CLI, but other consumers of the API won't receive this warning.

This patch adds a check for this situation to the daemon, so that all consumers
of the API will receive this warning.

This patch will have one side-effect; docker cli's that also perform this check
client-side will print the warning twice; this can be addressed by disabling
the cli-side check for newer API versions, but will generate a bit of extra
noise when using an older CLI.

With this patch applied (and a cli that does not take the new warning into account);

```
docker create --oom-kill-disable busybox
WARNING: OOM killer is disabled for the container, but no memory limit is set, this can result in the system running out of resources.
669933b9b237fa27da699483b5cf15355a9027050825146587a0e5be0d848adf

docker run --rm --oom-kill-disable busybox
WARNING: Disabling the OOM killer on containers without setting a '-m/--memory' limit may be dangerous.
WARNING: OOM killer is disabled for the container, but no memory limit is set, this can result in the system running out of resources.
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-18 22:30:56 +01:00
Vincent Demeester
56cc56b0fa
Merge pull request #38126 from mjameswh/fix-1715
Use idtools.LookupGroup instead of parsing /etc/group file for docker.sock ownership
2018-12-12 17:29:28 +01:00
Vincent Demeester
d4a6e1c44f
Merge pull request #38068 from kolyshkin/err
More context for errors
2018-12-12 09:02:37 +01:00
Akihiro Suda
62d80835ab
Merge pull request #38342 from crosbymichael/oci-refactor
Move caps and device spec utils to `oci` pkg
2018-12-11 13:48:38 -08:00
Vincent Demeester
510805655b
Merge pull request #38265 from AkihiroSuda/remove-migrate-v1
Remove v1.10 migrator
2018-12-11 16:21:09 +01:00
Michael Crosby
b940cc5cff Move caps and device spec utils to oci pkg
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-12-11 10:20:25 -05:00
Kir Kolyshkin
6533136961 pkg/mount: wrap mount/umount errors
The errors returned from Mount and Unmount functions are raw
syscall.Errno errors (like EPERM or EINVAL), which provides
no context about what has happened and why.

Similar to os.PathError type, introduce mount.Error type
with some context. The error messages will now look like this:

> mount /tmp/mount-tests/source:/tmp/mount-tests/target, flags: 0x1001: operation not permitted

or

> mount tmpfs:/tmp/mount-test-source-516297835: operation not permitted

Before this patch, it was just

> operation not permitted

[v2: add Cause()]
[v3: rename MountError to Error, document Cause()]
[v4: fixes; audited all users]
[v5: make Error type private; changes after @cpuguy83 reviews]

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-12-10 20:07:02 -08:00
Kir Kolyshkin
2f98b5f51f aufs: get rid of mount()
The function is not needed as it's just a shallow wrapper around
unix.Mount().

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-12-10 20:06:10 -08:00
Kir Kolyshkin
77bc327e24 UnmountIpcMount: simplify
As standard mount.Unmount does what we need, let's use it.

In addition, this adds ignoring "not mounted" condition, which
was previously implemented (see PR#33329, commit cfa2591d3f)
via a very expensive call to mount.Mounted().

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-12-10 20:06:10 -08:00
Tibor Vass
6e3113f700
Merge pull request #38327 from andrewhsu/ctrd
update containerd to v1.2.1
2018-12-10 17:28:50 +01:00
Yong Tang
1082d1edf2 go vet fix for TestfillLicense
This small fix renames `TestfillLicense` to `TestFillLicense`
as otherwise go vet reports:
```
$ go tool vet daemon/licensing_test.go
daemon/licensing_test.go:11: TestfillLicense has malformed name: first letter after 'Test' must not be lowercase
```

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-12-09 00:51:37 +00:00
Yong Tang
fa6dabf876 Add zero padding for RFC5424 syslog format
This fix tries to address the issue raised in 38258
where current RFC5424 sys log format does not zero pad
the time (trailing zeros are removed)

This fix apply the patch to fix the issue. This fix fixes 38258.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-12-08 22:40:02 +00:00
Andrew Hsu
78045a5419
use empty string as cgroup path to grab first find
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-07 18:44:00 +01:00
Yong Tang
65d9a5dde5
Merge pull request #38267 from thaJeztah/wrap_errors
Use errors.Wrap() in daemon/config
2018-12-03 08:30:40 -08:00
Aleksa Sarai
f38ac72bca
oci: add integration tests for kernel.domainname configuration
This also includes a few refactors of oci_linux_test.go.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2018-11-30 19:44:50 +11:00
Aleksa Sarai
7417f50575
oci: include the domainname in "kernel.domainname"
The OCI doesn't have a specific field for an NIS domainname[1] (mainly
because FreeBSD and Solaris appear to have a similar concept but it is
configured entirely differently).

However, on Linux, the NIS domainname can be configured through both the
setdomainname(2) syscall but also through the "kernel.domainname"
sysctl. Since the OCI has a way of injecting sysctls this means we don't
need to have any OCI changes to support NIS domainnames (and we can
always switch if the OCI picks up such support in the future).

It should be noted that because we have to generate this each spec
creation we also have to make sure that it's not clobbered by the
HostConfig. I'm pretty sure making this change generic (so that
HostConfig will not clobber any pre-set sysctls) will not cause other
issues to crop up.

[1]: https://github.com/opencontainers/runtime-spec/issues/592

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2018-11-30 17:31:38 +11:00
Sebastiaan van Stijn
a8d2b29e8d
Use errors.Wrap() in daemon/config
using `errors.Wrap()` preserves the original error

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-11-30 01:27:47 +01:00
Sebastiaan van Stijn
813a7da526
Revert "Add limit to page size used by overlay2 driver"
This reverts commit 520034e35b.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-11-29 23:02:18 +01:00
James Watkins-Harvey
a2e384682b Use idtools.LookupGroup instead of parsing /etc/group file for docker.sock ownership
Signed-off-by: James Watkins-Harvey <jwatkins@progi-media.com>
2018-11-29 16:24:42 -05:00
Sebastiaan van Stijn
6f70946a27
Add warning to /info if KernelMemoryTCP is not supported
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-11-27 22:47:39 +01:00
Sebastiaan van Stijn
d3e75e4220
Merge pull request #37043 from yongtang/37038-kernelTCP
Add memory.kernelTCP support for linux
2018-11-27 22:36:10 +01:00
Vincent Demeester
6fa149805c
Merge pull request #37638 from jterry75/devices_windows
Add --device support for Windows
2018-11-27 15:03:17 +01:00
Yong Tang
f023816608 Add memory.kernelTCP support for linux
This fix tries to address the issue raised in 37038 where
there were no memory.kernelTCP support for linux.

This fix add MemoryKernelTCP to HostConfig, and pass
the config to runtime-spec.

Additional test case has been added.

This fix fixes 37038.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-11-26 21:03:08 +00:00
Sebastiaan van Stijn
0b7cb16dde
Merge pull request #38102 from selansen/master
VXLAN UDP Port configuration support
2018-11-24 11:50:10 +01:00
Akihiro Suda
1fea38856a Remove v1.10 migrator
The v1.10 layout and the migrator was added in 2015 via #17924.

Although the migrator is not marked as "deprecated" explicitly in
cli/docs/deprecated.md, I suppose people should have already migrated
from pre-v1.10 and they no longer need the migrator, because pre-v1.10
version do not support schema2 images (and these versions no longer
receives security updates).

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-11-24 17:45:13 +09:00
selansen
32180ac0c7 VXLAN UDP Port configuration support
This commit contains changes to configure DataPathPort
option. By default we use 4789 port number. But this commit
will allow user to configure port number during swarm init.
DataPathPort can't be modified after swarm init.
Signed-off-by: selansen <elango.siva@docker.com>
2018-11-22 17:35:02 -05:00
zhangyue
5007c36d71 cli: fix images filter when use multi reference filter
Signed-off-by: zhangyue <zy675793960@yeah.net>
2018-11-22 10:33:45 +08:00
Justin Terry (VM)
b2d99865ea Add --device support for Windows
Implements the --device forwarding for Windows daemons. This maps the physical
device into the container at runtime.

Ex:

docker run --device="class/<clsid>" <image> <cmd>

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-11-21 15:31:17 -08:00
Sebastiaan van Stijn
758255791e
Merge pull request #38177 from mooncak/fix_duplicate
Cleanup duplication in daemon files
2018-11-13 09:55:51 +01:00
mooncake
345d1fd089 Cleanup duplication in daemon files
Signed-off-by: Bily Zhang <xcoder@tenxcloud.com>
2018-11-13 10:42:57 +08:00
Akihiro Suda
596cdffb9f mount: add BindOptions.NonRecursive (API v1.40)
This allows non-recursive bind-mount, i.e. mount(2) with "bind" rather than "rbind".

Swarm-mode will be supported in a separate PR because of mutual vendoring.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-11-06 17:51:58 +09:00
Sebastiaan van Stijn
12bba16306
Merge pull request #38029 from lifubang/checkpointrm
fixes checkpoint rm fail
2018-11-05 19:09:35 +01:00
Tonis Tiigi
489b8eda66 cluster: set bigger grpc limit for array requests
4MB client side limit was introduced in vendoring go-grpc#1165 (v1.4.0)
making these requests likely to produce errors

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-10-30 16:02:34 -07:00
Sebastiaan van Stijn
13ef0ebd2b
Deprecate AuFS storage driver, and add warning
The `aufs` storage driver is deprecated in favor of `overlay2`, and will
be removed in a future release. Users of the `aufs` storage driver are
recommended to migrate to a different storage driver, such as `overlay2`, which
is now the default storage driver.

The `aufs` storage driver facilitates running Docker on distros that have no
support for OverlayFS, such as Ubuntu 14.04 LTS, which originally shipped with
a 3.14 kernel.

Now that Ubuntu 14.04 is no longer a supported distro for Docker, and `overlay2`
is available to all supported distros (as they are either on kernel 4.x, or have
support for multiple lowerdirs backported), there is no reason to continue
maintenance of the `aufs` storage driver.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-26 18:41:46 +02:00
Sebastiaan van Stijn
1527a67212
Merge pull request #37999 from Microsoft/jjh/tar2vhd
LCOW: ApplyDiff() use tar2ext4, not SVM
2018-10-24 22:35:34 +02:00
Sebastiaan van Stijn
b48bf39a79
Merge pull request #37944 from IRCody/awslogs_error_context
Return more context on awslogs create failure
2018-10-24 21:00:15 +02:00
Anusha Ragunathan
6611ab1c6f
Merge pull request #37986 from samuelkarp/moby/moby-37747
awslogs: account for UTF-8 normalization in limits
2018-10-18 10:17:24 -07:00
Yong Tang
533e07afbe
Merge pull request #38032 from RohitK89/21497-log-image-name
Add IMAGE_NAME attribute to journald log events
2018-10-17 12:18:05 -07:00
Colin Panisset
5cd2bb315a Only add CONTAINER_PARTIAL_MESSAGE if not the last partial
Addresses #38045

Signed-off-by: Colin Panisset <colin.panisset@cevo.com.au>
2018-10-17 07:51:59 +11:00
Cody Roseborough
7a5c813d9c Return more context on awslogs create failure
Signed-off-by: Cody Roseborough <crrosebo@amazon.com>
2018-10-16 11:36:52 -07:00
Yong Tang
ee6fc90b2c
Merge pull request #37993 from kolyshkin/ovr2-index
overlay2: use index=off if possible (fix EBUSY on mount)
2018-10-13 08:28:10 -07:00
Yong Tang
9d4ac4b8d2
Merge pull request #38019 from thaJeztah/skip_deprecated_drivers_in_autoselect
Skip deprecated storage-drivers in auto-selection
2018-10-13 08:26:03 -07:00
Rohit Kapur
5f7e102df7 Add IMAGE_NAME as a key to journald log messages
Signed-off-by: Rohit Kapur <rkapur@flatiron.com>
2018-10-12 16:16:31 -04:00
Vincent Demeester
10ebe6381e
Merge pull request #38025 from thaJeztah/itsy_bitsy_teeny_weeny
Remove redundant nil checks
2018-10-12 18:43:11 +02:00
Lifubang
99a7a4dcd0 checkpoint rm fail
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-10-12 19:08:28 +08:00
Kir Kolyshkin
16d822bba8 btrfs: ensure graphdriver home is bind mount
For some reason, shared mount propagation between the host
and a container does not work for btrfs, unless container
root directory (i.e. graphdriver home) is a bind mount.

The above issue was reproduced on SLES 12sp3 + btrfs using
the following script:

	#!/bin/bash
	set -eux -o pipefail

	# DIR should not be under a subvolume
	DIR=${DIR:-/lib}
	MNT=$DIR/my-mnt
	FILE=$MNT/file

	ID=$(docker run -d --privileged -v $DIR:$DIR:rshared ubuntu sleep 24h)
	docker exec $ID mkdir -p $MNT
	docker exec $ID mount -t tmpfs tmpfs $MNT
	docker exec $ID touch $FILE
	ls -l $FILE
	umount $MNT
	docker rm -f $ID

which fails this way:

	+ ls -l /lib/my-mnt/file
	ls: cannot access '/lib/my-mnt/file': No such file or directory

meaning the mount performed inside a priviledged container is not
propagated back to the host (even if all the mounts have "shared"
propagation mode).

The remedy to the above is to make graphdriver home a bind mount.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-10-11 23:45:00 -07:00
Sebastiaan van Stijn
de1094bc95
Remove redundant nil checks
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-11 23:19:01 +02:00
Kir Kolyshkin
8422d85087 overlay2: use index=off if possible
As pointed out in https://github.com/moby/moby/issues/37970,
Docker overlay driver can't work with index=on feature of
the Linux kernel "overlay" filesystem. In case the global
default is set to "yes", Docker will fail with EBUSY when
trying to mount, like this:

> error creating overlay mount to ...../merged: device or resource busy

and the kernel log should contain something like:

> overlayfs: upperdir is in-use by another mount, mount with
> '-o index=off' to override exclusive upperdir protection.

A workaround is to set index=off in overlay kernel module
parameters, or even recompile the kernel with
CONFIG_OVERLAY_FS_INDEX=n in .config. Surely this is not
always practical or even possible.

The solution, as pointed out my Amir Goldstein (as well as
the above kernel message:) is to use 'index=off' option
when mounting.

NOTE since older (< 4.13rc1) kernels do not support "index="
overlayfs parameter, try to figure out whether the option
is supported. In case it's not possible to figure out,
assume it is not.

NOTE the default can be changed anytime (by writing to
/sys/module/overlay/parameters/index) so we need to always
use index=off.

[v2: move the detection code to Init()]
[v3: don't set index=off if stat() failed]

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-10-11 12:52:57 -07:00
Kir Kolyshkin
a55d32546a overlay2: use global logger instance
This simplifies the code a lot.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-10-11 12:50:45 -07:00
Sebastiaan van Stijn
b72db8b82c
Skip deprecated storage-drivers in auto-selection
Discourage users from using deprecated storage-drivers
by skipping them when automatically selecting a storage-
driver.

This change does not affect existing installations, because
existing state will take precedence.

Users can still use deprecated drivers by manually configuring
the daemon to use a specific driver.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-11 15:52:19 +02:00
Sebastiaan van Stijn
31be4e0ba1
Deprecate legacy overlay storage driver, and add warning
The `overlay` storage driver is deprecated in favor of the `overlay2` storage
driver, which has all the benefits of `overlay`, without its limitations (excessive
inode consumption). The legacy `overlay` storage driver will be removed in a future
release. Users of the `overlay` storage driver should migrate to the `overlay2`
storage driver.

The legacy `overlay` storage driver allowed using overlayFS-backed filesystems
on pre 4.x kernels. Now that all supported distributions are able to run `overlay2`
(as they are either on kernel 4.x, or have support for multiple lowerdirs
backported), there is no reason to keep maintaining the `overlay` storage driver.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-11 15:49:15 +02:00
Sebastiaan van Stijn
06fcabbaa0
Deprecate "devicemapper" storage driver, and add warning
The `devicemapper` storage driver is deprecated in favor of `overlay2`, and will
be removed in a future release. Users of the `devicemapper` storage driver are
recommended to migrate to a different storage driver, such as `overlay2`, which
is now the default storage driver.

The `devicemapper` storage driver facilitates running Docker on older (3.x) kernels
that have no support for other storage drivers (such as overlay2, or AUFS).

Now that support for `overlay2` is added to all supported distros (as they are
either on kernel 4.x, or have support for multiple lowerdirs backported), there
is no reason to continue maintenance of the `devicemapper` storage driver.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-11 15:46:26 +02:00
Samuel Karp
1e8ef38627 awslogs: account for UTF-8 normalization in limits
The CloudWatch Logs API defines its limits in terms of bytes, but its
inputs in terms of UTF-8 encoded strings.  Byte-sequences which are not
valid UTF-8 encodings are normalized to the Unicode replacement
character U+FFFD, which is a 3-byte sequence in UTF-8.  This replacement
can cause the input to grow, exceeding the API limit and causing failed
API calls.

This commit adds logic for counting the effective byte length after
normalization and splitting input without splitting valid UTF-8
byte-sequences into two invalid byte-sequences.

Fixes https://github.com/moby/moby/issues/37747

Signed-off-by: Samuel Karp <skarp@amazon.com>
2018-10-10 14:45:06 -07:00
Sebastiaan van Stijn
6efa2767d4
Merge pull request #38000 from Microsoft/jjh/processandiot
Windows: Client: Allow process isolation [RS5+]
2018-10-10 19:29:23 +02:00
John Howard
bde9996065 LCOW: ApplyDiff() use tar2ext4, not SVM
Signed-off-by: John Howard <jhoward@microsoft.com>

This removes the need for an SVM in the LCOW driver to ApplyDiff.

This change relates to a fix for https://github.com/moby/moby/issues/36353

However, it found another issue, tracked by https://github.com/moby/moby/issues/37955
2018-10-09 16:10:46 -07:00
Yong Tang
82a4797499
Merge pull request #37988 from mirake/fix-typos
Fix typo: adapater -> adapter
2018-10-09 12:47:18 -07:00
John Howard
c907c2486c Windows:Allow process isolation
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-10-09 11:58:26 -07:00
Yong Tang
2cc338c100
Merge pull request #37967 from thaJeztah/upstream_dos_fix
Fix denial of service with large numbers in cpuset-cpus and cpuset-mems
2018-10-08 13:23:03 +00:00
Sebastiaan van Stijn
fddefa72c4
Merge pull request #37983 from IRCody/tar_id_logging
Add layer id to NaiveDiffDriver untar timing log
2018-10-08 14:17:41 +02:00
Rui Cao
d3e155d926 Fix typo: adapater -> adapter
Signed-off-by: Rui Cao <ruicao@alauda.io>
2018-10-08 19:15:38 +08:00
Vincent Demeester
2bbd0bd8ef
Merge pull request #37802 from Microsoft/jjh/37687-docker-system-df
Fix docker system df when LCOW and WCOW images loaded
2018-10-08 09:26:35 +02:00
Akihiro Suda
b5ed4ebe06
Merge pull request #36537 from Microsoft/jjh/lcow-log-stderr
LCOW: Log stderr on failures to ease diagnosis
2018-10-06 11:05:55 +09:00
Cody Roseborough
3b4df3d146 Add layer id to NaiveDiffDriver untar timing log
Signed-off-by: Cody Roseborough <crrosebo@amazon.com>
2018-10-05 16:28:40 -07:00
mooncake
ea60a87fcf Remove duplicated words in daemon files
Signed-off-by: mooncake <xcoder@tenxcloud.com>
2018-10-06 00:06:38 +08:00
Justin Cormack
f8e876d761
Fix denial of service with large numbers in cpuset-cpus and cpuset-mems
Using a value such as `--cpuset-mems=1-9223372036854775807` would cause
`dockerd` to run out of memory allocating a map of the values in the
validation code. Set limits to the normal limit of the number of CPUs,
and improve the error handling.

Reported by Huawei PSIRT.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-05 15:09:02 +02:00
Vincent Demeester
e3b712152d
Merge pull request #37968 from thaJeztah/no_more_version_mismatch
Remove version-checks for containerd and runc
2018-10-05 12:07:44 +02:00
Sebastiaan van Stijn
c65f0bd13c
Remove version-checks for containerd and runc
With containerd reaching 1.0, the runtime now
has a stable API, so there's no need to do a check
if the installed version matches the expected version.

Current versions of Docker now also package containerd
and runc separately, and can be _updated_ separately.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-04 23:17:13 +02:00
Sebastiaan van Stijn
192ff56d87
Merge pull request #37949 from selansen/master
Fix for default-addr-pool-mask-length param max value check
2018-10-04 22:00:42 +02:00
Sebastiaan van Stijn
9c4982685e
Merge pull request #37934 from dani-docker/esc-879
Masking proxy credentials from URL when displayed in system info
2018-10-04 19:37:58 +02:00
selansen
d25c5df80e Fix for default-addr-pool-mask-length param max value check
We check for max value for -default-addr-pool-mask-length param as 32.
But There won't be enough addresses on the  overlay network. Hence we are
keeping it 29 so that we would be having atleast 8 addresses in /29 network.

Signed-off-by: selansen <elango.siva@docker.com>
2018-10-04 00:30:22 -04:00
Sebastiaan van Stijn
f4d74d3802
Merge pull request #37774 from simonferquel/windows-network-plugin-miss-fix
Fix long startup on windows, with non-hns governed Hyper-V networks
2018-10-03 19:26:19 +02:00
Kir Kolyshkin
c378fb774e gd/dm: fix error message
The parameter name was wrong, which may mislead a user.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-10-02 16:19:08 -07:00
Dani Louca
78fd978454 Masking credentials from proxy URL
Signed-off-by: Dani Louca <dani.louca@docker.com>
2018-10-01 14:06:00 -04:00
Brian Goff
299015de40
Merge pull request #37888 from lifubang/renameimprove
oldName release too early when docker rename
2018-10-01 09:00:09 -07:00
Sebastiaan van Stijn
deac65c929
Merge pull request #37850 from AkihiroSuda/propagate-exec-root-to-libnetwork
daemon: propagate exec-root to libnetwork-setkey
2018-09-28 15:20:37 +02:00
John Howard
63f9c7784b LCOW: Log stderr on failures
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-09-26 13:23:04 -07:00
Yong Tang
7bfec8cd80
Merge pull request #37400 from olljanat/34795-allow-npipe
Allow mount type npipe on service/stack
2018-09-26 09:54:42 -07:00
Yong Tang
472a52861c
Merge pull request #37907 from tiborvass/remove-docker-prefix-containerd
Remove 'docker-' prefix for containerd and runc binaries
2018-09-26 02:52:31 -07:00
Vincent Demeester
9f296d1e6f
Merge pull request #37701 from dperny/add-swarmkit-sysctl-support
Add support for sysctl options in services
2018-09-26 09:06:22 +02:00
Brian Goff
12d5eb8e22
Merge pull request #37703 from kolyshkin/rm-dead-code
daemon/setMounts(): remove dead code
2018-09-25 16:07:15 -07:00
Tibor Vass
34eede0296 Remove 'docker-' prefix for containerd and runc binaries
This allows to run the daemon in environments that have upstream containerd installed.

Signed-off-by: Tibor Vass <tibor@docker.com>
2018-09-24 21:49:03 +00:00
Sebastiaan van Stijn
2a63a5f7a5
Merge pull request #37891 from mirake/fix-typos
Fix some typos
2018-09-24 17:22:34 +02:00
Tibor Vass
4a776d0ca7 builder: use buildkit's GC for build cache
This allows users to configure the buildkit GC.

The following enables the default GC:
```
{
  "builder": {
    "gc": {
      "enabled": true
    }
  }
}
```

The default GC policy has a simple config:
```
{
  "builder": {
    "gc": {
      "enabled": true,
      "defaultKeepStorage": "30GB"
    }
  }
}
```

A custom GC policy can be used instead by specifying a list of cache prune rules:
```
{
  "builder": {
    "gc": {
      "enabled": true,
      "policy": [
        {"keepStorage": "512MB", "filter": ["unused-for=1400h"]]},
        {"keepStorage": "30GB", "all": true}
      ]
    }
  }
}
```

Signed-off-by: Tibor Vass <tibor@docker.com>
2018-09-21 22:06:00 +00:00
Tõnis Tiigi
b1116479b2
Merge pull request #37852 from AntaresS/patch-buildkit
add support for "registry-mirrors" and "insecure-registries" to buildkit
2018-09-21 09:42:35 -07:00
Lifubang
73cf7dfe17 docker rename enhancement
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-09-21 09:43:06 +08:00
Anda Xu
171d51c861 add support of registry-mirrors and insecure-registries to buildkit
Signed-off-by: Anda Xu <anda.xu@docker.com>
2018-09-20 11:53:02 -07:00
Drew Erny
14da20f5e7 Add support for sysctl options in services
Adds support for sysctl options in docker services.

* Adds API plumbing for creating services with sysctl options set.
* Adds swagger.yaml documentation for new API field.
* Updates the API version history document.
* Changes executor package to make use of the Sysctls field on objects
* Includes integration test to verify that new behavior works.

Essentially, everything needed to support the equivalent of docker run's
`--sysctl` option except the CLI.

Includes a vendoring of swarmkit for proto changes to support the new
behavior.

Signed-off-by: Drew Erny <drew.erny@docker.com>
2018-09-20 10:51:56 -05:00
Rui Cao
3f02d91ef8 Fix some typos
Signed-off-by: Rui Cao <ruicao@alauda.io>
2018-09-20 20:00:35 +08:00
Sebastiaan van Stijn
dc26e1e7b7
Merge pull request #37871 from AntaresS/fix-config-conflicts
fix daemon won't start bug caused by daemon.json and cli flags duplications
2018-09-19 20:19:54 +02:00
Sebastiaan van Stijn
d6a7c22f7b
Merge pull request #37861 from TinySong/fix-typo
fix typos in service.go and plugin.go
2018-09-18 12:48:37 +02:00
Vincent Demeester
8efb908581
Merge pull request #37847 from thaJeztah/more_permissive_daeon_conf_dir
Loosen permissions on /etc/docker directory
2018-09-18 08:49:38 +02:00
song
c80e20f93f fix typos in service.go and plugin.go
Signed-off-by: song <tinysong1226@gmail.com>
Signed-off-by: Rongxiang Song <tinysong1226@gmail.com>
2018-09-18 10:48:39 +08:00
Anda Xu
8392d0930b fixed the dockerd won't start bug when 'runtimes' field is defined in both daemon config file and cli flags
Signed-off-by: Anda Xu <anda.xu@docker.com>
2018-09-17 16:12:04 -07:00
Olli Janatuinen
83d9b9e4d9 Allow mount type npipe on Windows
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2018-09-16 06:57:38 +00:00
Akihiro Suda
40385208cb daemon: propagate exec-root to libnetwork-setkey
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-09-15 13:49:30 +09:00
Tibor Vass
5aa222d0fe daemon/images: removed "found leaked image layer" warning, because it is expected now with buildkit
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-09-15 01:14:00 +00:00
Sebastiaan van Stijn
9299561bd3
Merge pull request #37736 from selansen/master
Global Default AddressPool - Update
2018-09-14 18:47:42 +02:00
Sebastiaan van Stijn
cecd981717
Loosen permissions on /etc/docker directory
The `/etc/docker` directory is used both by the dockerd daemon
and the docker cli (if installed on the saem host as the daemon).

In situations where the `/etc/docker` directory does not exist,
and an initial `key.json` (legacy trust key) is generated (at the
default location), the `/etc/docker/` directory was created with
0700 permissions, making the directory only accessible by `root`.

Given that the `0600` permissions on the key itself already protect
it from being used by other users, the permissions of `/etc/docker`
can be less restrictive.

This patch changes the permissions for the directory to `0755`, so
that the CLI (if executed as non-root) can also access this directory.

> **NOTE**: "strictly", this patch is only needed for situations where no _custom_
> location for the trustkey is specified (not overridden with `--deprecated-key-path`),
> but setting the permissions only for the "default" case would make
> this more complicated.

```bash
make binary shell

make install

ls -la /etc/ | grep docker

dockerd
^C

ls -la /etc/ | grep docker
drwxr-xr-x 2 root root    4096 Sep 14 12:11 docker
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-09-14 14:14:39 +02:00
selansen
148ff00a0a Global Default AddressPool - Update
Addressing few review comments as part of code refactoring.
Also moved validation logic from CLI to Moby.

Signed-off-by: selansen <elango.siva@docker.com>
2018-09-11 19:02:54 -04:00
Kir Kolyshkin
b2b169f13f daemon/logger/journald: simplify readers field
As in other similar drivers (jsonlog, local), use a set
(i.e. `map[whatever]struct{}`), making the code simpler.

While at it, make sure we remove the reader from the set
after calling `ProducerGone()` on it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-10 16:17:05 -07:00
John Howard
98380b1791 Fix docker system df when LCOW and WCOW images loaded
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-09-10 10:56:56 -07:00
Sebastiaan van Stijn
77faf158f5
Merge pull request #37576 from kolyshkin/logs-f-leak
daemon.ContainerLogs(): fix resource leak on follow
2018-09-10 14:26:43 +02:00
Yong Tang
703a04ebc9
Merge pull request #37712 from Microsoft/jjh/detach
Windows: Try to detach sandbox on cleanup to avoid permission denied
2018-09-09 16:50:27 -07:00
Sebastiaan van Stijn
3d9adede13
Merge pull request #37782 from jianliao82/patch-1
fix a couple of typo
2018-09-08 09:44:00 +02:00
jliao
7427fe12d8 fix typo
fix typo

Signed-off-by: jian liao <jliao@alauda.io>
2018-09-08 08:13:30 +08:00
Sebastiaan van Stijn
e33ea4fbde
Merge pull request #37794 from Lihua93/fixtypos
Fix typos in comment
2018-09-07 16:46:46 +02:00
Doug Davis
9c3c3537ec
Merge pull request #37796 from mirake/fix-typo
Typo fix: retore -> restore
2018-09-07 06:24:35 -04:00
ruicao
1ca3ea121e Typo fix: retore -> restore
Signed-off-by: ruicao <ruicao@alauda.io>
2018-09-07 13:55:31 +08:00
Lihua Tang
8df0b2de54 Fix typos in comment
Signed-off-by: Lihua Tang <lhtang@alauda.io>
2018-09-07 13:17:42 +08:00
Kir Kolyshkin
9b0097a699 Format code with gofmt -s from go-1.11beta1
This should eliminate a bunch of new (go-1.11 related) validation
errors telling that the code is not formatted with `gofmt -s`.

No functional change, just whitespace (i.e.
`git show --ignore-space-change` shows nothing).

Patch generated with:

> git ls-files | grep -v ^vendor/ | grep .go$ | xargs gofmt -s -w

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-06 15:24:16 -07:00
John Howard
efdad53744 Windows: DetachVhd attempt in cleanup
Signed-off-by: John Howard <jhoward@microsoft.com>

This is a fix for a few related scenarios where it's impossible to remove layers or containers
until the host is rebooted. Generally (or at least easiest to repro) through a forced daemon kill
while a container is running.

Possibly slightly worse than that, as following a host reboot, the scratch layer would possibly be leaked and
left on disk under the dataroot\windowsfilter directory after the container is removed.

One such example of a failure:

1. run a long running container with the --rm flag
docker run --rm -d --name test microsoft/windowsservercore powershell sleep 30
2. Force kill the daemon not allowing it to cleanup. Simulates a crash or a host power-cycle.
3. (re-)Start daemon
4. docker ps -a
PS C:\control> docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                PORTS               NAMES
7aff773d782b        malloc              "powershell start-sl…"   11 seconds ago      Removal In Progress                       malloc
5. Try to remove
PS C:\control> docker rm 7aff
Error response from daemon: container 7aff773d782bbf35d95095369ffcb170b7b8f0e6f8f65d5aff42abf61234855d: driver "windowsfilter" failed to remove root filesystem: rename C:\control\windowsfilter\7aff773d782bbf35d95095369ffcb170b7b8f0e6f8f65d5aff42abf61234855d C:\control\windowsfilter\7aff773d782bbf35d95095369ffcb170b7b8f0e6f8f65d5aff42abf61234855d-removing: Access is denied.
PS C:\control>

Step 5 fails.
2018-09-06 13:17:50 -07:00
Kir Kolyshkin
f845d76d04 TestFollowLogsProducerGone: add
This should test that
 - all the messages produced are delivered (i.e. not lost)
 - followLogs() exits

Loosely based on the test having the same name by Brian Goff, see
https://gist.github.com/cpuguy83/e538793de18c762608358ee0eaddc197

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-06 11:48:37 -07:00
Kir Kolyshkin
916eabd459 daemon.ContainerLogs(): fix resource leak on follow
When daemon.ContainerLogs() is called with options.follow=true
(as in "docker logs --follow"), the "loggerutils.followLogs()"
function never returns (even then the logs consumer is gone).
As a result, all the resources associated with it (including
an opened file descriptor for the log file being read, two FDs
for a pipe, and two FDs for inotify watch) are never released.

If this is repeated (such as by running "docker logs --follow"
and pressing Ctrl-C a few times), this results in DoS caused by
either hitting the limit of inotify watches, or the limit of
opened files. The only cure is daemon restart.

Apparently, what happens is:

1. logs producer (a container) is gone, calling (*LogWatcher).Close()
for all its readers (daemon/logger/jsonfilelog/jsonfilelog.go:175).

2. WatchClose() is properly handled by a dedicated goroutine in
followLogs(), cancelling the context.

3. Upon receiving the ctx.Done(), the code in followLogs()
(daemon/logger/loggerutils/logfile.go#L626-L638) keeps to
send messages _synchronously_ (which is OK for now).

4. Logs consumer is gone (Ctrl-C is pressed on a terminal running
"docker logs --follow"). Method (*LogWatcher).Close() is properly
called (see daemon/logs.go:114). Since it was called before and
due to to once.Do(), nothing happens (which is kinda good, as
otherwise it will panic on closing a closed channel).

5. A goroutine (see item 3 above) keeps sending log messages
synchronously to the logWatcher.Msg channel. Since the
channel reader is gone, the channel send operation blocks forever,
and resource cleanup set up in defer statements at the beginning
of followLogs() never happens.

Alas, the fix is somewhat complicated:

1. Distinguish between close from logs producer and logs consumer.
To that effect,
 - yet another channel is added to LogWatcher();
 - {Watch,}Close() are renamed to {Watch,}ProducerGone();
 - {Watch,}ConsumerGone() are added;

*NOTE* that ProducerGone()/WatchProducerGone() pair is ONLY needed
in order to stop ConsumerLogs(follow=true) when a container is stopped;
otherwise we're not interested in it. In other words, we're only
using it in followLogs().

2. Code that was doing (logWatcher*).Close() is modified to either call
ProducerGone() or ConsumerGone(), depending on the context.

3. Code that was waiting for WatchClose() is modified to wait for
either ConsumerGone() or ProducerGone(), or both, depending on the
context.

4. followLogs() are modified accordingly:
 - context cancellation is happening on WatchProducerGone(),
and once it's received the FileWatcher is closed and waitRead()
returns errDone on EOF (i.e. log rotation handling logic is disabled);
 - due to this, code that was writing synchronously to logWatcher.Msg
can be and is removed as the code above it handles this case;
 - function returns once ConsumerGone is received, freeing all the
resources -- this is the bugfix itself.

While at it,

1. Let's also remove the ctx usage to simplify the code a bit.
It was introduced by commit a69a59ffc7 ("Decouple removing the
fileWatcher from reading") in order to fix a bug. The bug was actually
a deadlock in fsnotify, and the fix was just a workaround. Since then
the fsnofify bug has been fixed, and a new fsnotify was vendored in.
For more details, please see
https://github.com/moby/moby/pull/27782#issuecomment-416794490

2. Since `(*filePoller).Close()` is fixed to remove all the files
being watched, there is no need to explicitly call
fileWatcher.Remove(name) anymore, so get rid of the extra code.

Should fix https://github.com/moby/moby/issues/37391

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-06 11:47:42 -07:00
Brian Goff
d37a11bfba daemon/logger/loggerutils: add TestFollowLogsClose
This test case checks that followLogs() exits once the reader is gone.
Currently it does not (i.e. this test is supposed to fail) due to #37391.

[kolyshkin@: test case Brian Goff, changelog and all bugs are by me]
Source: https://gist.github.com/cpuguy83/e538793de18c762608358ee0eaddc197

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-06 11:46:34 -07:00
Kir Kolyshkin
2e4c2a6bf9 daemon.ContainerLogs: minor debug logging cleanup
This code has many return statements, for some of them the
"end logs" or "end stream" message was not printed, giving
the impression that this "for" loop never ended.

Make sure that "begin logs" is to be followed by "end logs".

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-06 11:45:50 -07:00
Sebastiaan van Stijn
7129bebe0a
Merge pull request #37665 from kolyshkin/dev-init
Fix docker --init with /dev bind mount
2018-09-06 13:16:10 +01:00
Simon Ferquel
6a1a4f9721 Fix long startup on windows, with non-hns governed Hyper-V networks
Similar to a related issue where previously, private Hyper-V networks
would each add 15 secs to the daemon startup, non-hns governed internal
networks are reported by hns as network type "internal" which is not
mapped to any network plugin (and thus we get the same plugin load retry
loop as before).

This issue hits Docker for Desktop because we setup such a network for
the Linux VM communication.

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2018-09-06 11:54:23 +02:00
Tibor Vass
8af91768c7
Merge pull request #37692 from AntaresS/live-reload-buildkit
allow features option live reloading
2018-09-01 17:03:23 -07:00
Anda Xu
58a75cebdd allow features option live reloadable
Signed-off-by: Anda Xu <anda.xu@docker.com>
2018-08-31 12:43:04 -07:00
Kir Kolyshkin
27d9030b23 Fix relabeling local volume source dir
In case a volume is specified via Mounts API, and SELinux is enabled,
the following error happens on container start:

> $ docker volume create testvol
> $ docker run --rm --mount source=testvol,target=/tmp busybox true
> docker: Error response from daemon: error setting label on mount
> source '': no such file or directory.

The functionality to relabel the source of a local mount specified via
Mounts API was introduced in commit 5bbf5cc and later broken by commit
e4b6adc, which removed setting mp.Source field.

With the current data structures, the host dir is already available in
v.Mountpoint, so let's just use it.

Fixes: e4b6adc
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-08-30 15:58:49 -07:00
Sebastiaan van Stijn
6f9b5ba810
Fix regression when filtering container names using a leading slash
Commit 5c8da2e967 updated the filtering behavior
to match container-names without having to specify the leading slash.

This change caused a regression in situations where a regex was provided as
filter, using an explicit leading slash (`--filter name=^/mycontainername`).

This fix changes the filters to match containers both with, and without the
leading slash, effectively making the leading slash optional when filtering.

With this fix, filters with and without a leading slash produce the same result:

    $ docker ps --filter name=^a
    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
    21afd6362b0c        busybox             "sh"                2 minutes ago       Up 2 minutes                            a2
    56e53770e316        busybox             "sh"                2 minutes ago       Up 2 minutes                            a1

    $ docker ps --filter name=^/a
    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
    21afd6362b0c        busybox             "sh"                2 minutes ago       Up 2 minutes                            a2
    56e53770e316        busybox             "sh"                3 minutes ago       Up 3 minutes                            a1

    $ docker ps --filter name=^b
    CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS              PORTS               NAMES
    b69003b6a6fe        busybox             "sh"                About a minute ago   Up About a minute                       b1

    $ docker ps --filter name=^/b
    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
    b69003b6a6fe        busybox             "sh"                56 seconds ago      Up 54 seconds                           b1

    $ docker ps --filter name=/a
    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
    21afd6362b0c        busybox             "sh"                3 minutes ago       Up 3 minutes                            a2
    56e53770e316        busybox             "sh"                4 minutes ago       Up 4 minutes                            a1

    $ docker ps --filter name=a
    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
    21afd6362b0c        busybox             "sh"                3 minutes ago       Up 3 minutes                            a2
    56e53770e316        busybox             "sh"                4 minutes ago       Up 4 minutes                            a1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-08-28 21:40:13 +02:00
Akihiro Suda
e8cc5a0b37
Merge pull request #37717 from taylanisikdemir/gcplogs-windows
Enable gcplogs driver on windows
2018-08-27 19:24:24 -07:00
Kir Kolyshkin
ac8c3debdb daemon/setMounts(): remove dead code
Since PR 11353 (commit 7804cd36ee "Filter out default mounts that
are override by user") there can be no duplicated mounts in the list,
so the check is redundant.

This should speed up container start by a nanosecond or two.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-08-27 15:40:10 -07:00
Kir Kolyshkin
bcacbf523b Fix docker --init with /dev bind mount
In case a user wants to have a child reaper inside a container
(i.e. run "docker --init") AND a bind-mounted /dev, the following
error occurs:

> docker run -d -v /dev:/dev --init busybox top
> 088c96808c683077f04c4cc2711fddefe1f5970afc085d59e0baae779745a7cf
> docker: Error response from daemon: OCI runtime create failed: container_linux.go:296: starting container process caused "exec: "/dev/init": stat /dev/init: no such file or directory": unknown.

This happens because if a user-suppled /dev is provided, all the
built-in /dev/xxx mounts are filtered out.

To solve, let's move in-container init to /sbin, as the chance that
/sbin will be bind-mounted to a container is smaller than that for /dev.
While at it, let's give it more unique name (docker-init).

NOTE it still won't work for the case of bind-mounted /sbin.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-08-27 15:38:46 -07:00
SeungUkLee
a79f8b48d4 fixed typo (becuase -> because)
Signed-off-by: SeungUkLee <lsy931106@gmail.com>
2018-08-26 17:30:40 +09:00
Sebastiaan van Stijn
41481abdc6
Merge pull request #37674 from Microsoft/jjh/revendor82018
Revendor Microsoft/hcsshim and go-winio, plus container/containerd
2018-08-25 19:54:22 +02:00
Taylan Isikdemir
2f81dc358a enable gcplogs driver on windows
Signed-off-by: Taylan Isikdemir <taylani@google.com>
2018-08-23 20:02:04 +00:00
John Howard
5accd82634 Add containerd.WithTimeout(60*time.Second) to match old calls
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-08-23 12:03:43 -07:00
Phil Estes
f962bd06ed
Fix incorrect spelling in error message
Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2018-08-22 11:28:11 -04:00
Sebastiaan van Stijn
a0385f7ad7
Merge pull request #37650 from anshulpundir/vndr
Add support for filtering on node labels
2018-08-22 12:51:47 +01:00
Tibor Vass
ef50da44b3
Merge pull request #37688 from tiborvass/features-not-flat
Fix logic when enabling buildkit
2018-08-21 18:56:41 -07:00
Tibor Vass
1cc3deebc4
Merge pull request #37684 from thaJeztah/add_remote_api_warning
Add warning if REST API is accessible through an insecure connection
2018-08-21 16:52:37 -07:00
Tibor Vass
c973cde760 Fix logic when enabling buildkit
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-08-21 23:49:08 +00:00
Sebastiaan van Stijn
3bd1e7b59b
Merge pull request #37636 from thaJeztah/add_swarm_label_tests
Add unit test for swarm labels on containers
2018-08-21 23:02:46 +01:00
Anshul Pundir
514ce73391
Changes to cluster/filter, swagger.yaml, version-history.md for filtering on node labels.
Signed-off-by: Anshul Pundir <anshul.pundir@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-08-21 22:17:23 +02:00
Sebastiaan van Stijn
547b993e07
Add warning if REST API is accessible through an insecure connection
The remote API allows full privilege escalation and is equivalent to
having root access on the host. Because of this, the API should never
be accessible through an insecure connection (TCP without TLS, or TCP
without TLS  verification).

Although a warning is already logged on startup if the daemon uses an
insecure configuration, this warning is not very visible (unless someone
decides to read the logs).

This patch attempts to make insecure configuration more visible by sending
back warnings through the API (which will be printed when using `docker info`).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-08-21 22:03:24 +02:00
Sebastiaan van Stijn
a3d4238b9c
Add "Warnings" to /info endpoint, and move detection to the daemon
When requesting information about the daemon's configuration through the `/info`
endpoint, missing features (or non-recommended settings) may have to be presented
to the user.

Detecting these situations, and printing warnings currently is handled by the
cli, which results in some complications:

- duplicated effort: each client has to re-implement detection and warnings.
- it's not possible to generate warnings for reasons outside of the information
  returned in the `/info` response.
- cli-side detection has to be updated for new conditions. This means that an
  older cli connecting to a new daemon may not print all warnings (due to
  it not detecting the new conditions)
- some warnings (in particular, warnings about storage-drivers) depend on
  driver-status (`DriverStatus`) information. The format of the information
  returned in this field is not part of the API specification and can change
  over time, resulting in cli-side detection no longer being functional.

This patch adds a new `Warnings` field to the `/info` response. This field is
to return warnings to be presented by the user.

Existing warnings that are currently handled by the CLI are copied to the daemon
as part of this patch; This change is backward-compatible with existing
clients; old client can continue to use the client-side warnings, whereas new
clients can skip client-side detection, and print warnings that are returned by
the daemon.

Example response with this patch applied;

```bash
curl --unix-socket /var/run/docker.sock http://localhost/info | jq .Warnings
```

```json
[
  "WARNING: bridge-nf-call-iptables is disabled",
  "WARNING: bridge-nf-call-ip6tables is disabled"
]
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-08-21 11:36:15 +02:00
Tibor Vass
1800883bd1
Merge pull request #37558 from selansen/master
Global Default Address Pool feature support
2018-08-20 18:15:44 -07:00
Tibor Vass
9d71a574fe
Merge pull request #37604 from dperny/task-wait-for-attachments
Block task starting until node attachments are ready
2018-08-20 18:14:44 -07:00
Tibor Vass
cf72051c37
Merge pull request #37620 from tonistiigi/buildkit-net-modes
buildkit: enable net modes and bridge
2018-08-20 14:56:24 -07:00
Sebastiaan van Stijn
715aa064ad
Merge pull request #37675 from cpuguy83/unused_logging_code
Remove now unused multireader.
2018-08-20 22:12:38 +01:00
Drew Erny
3c81dc3103 Block task starting until node attachments are ready
Blocks the execution of tasks during the Prepare phase until there
exists an IP address for every overlay network in use by the task. This
prevents a task from starting before the NetworkAttachment containing
the IP address has been sent down to the node.

Includes a basic test for the correct use case.

Signed-off-by: Drew Erny <drew.erny@docker.com>
2018-08-20 15:28:15 -05:00
selansen
f7ad95cab9 Global Default Address Pool feature support
This feature allows user to specify list of subnets for global
default address pool. User can configure subnet list using
'swarm init' command. Daemon passes the information to swarmkit.
We validate the information in swarmkit, then store it in cluster
object. when IPAM init is called, we pass subnet list to IPAM driver.

Signed-off-by: selansen <elango.siva@docker.com>
2018-08-20 15:07:08 -04:00
Tonis Tiigi
d6424a088d builder: setup code for a bridge networking
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-08-20 18:55:01 +00:00
Sebastiaan van Stijn
9916827496
Merge pull request #37593 from AntaresS/add-enable-buildkit
[enhancement] add optional fields in daemon.json to enable buildkit
2018-08-20 19:41:56 +01:00
Brian Goff
5da8bc2e5b Remove now unused multireader.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-08-20 09:42:19 -07:00
Sebastiaan van Stijn
e0ad6d045c
Merge pull request #37092 from cpuguy83/local_logger
Add "local" log driver
2018-08-20 07:01:41 +01:00
Anda Xu
2be17666b4 add optional fields in daemon.json to enable buildkit
Signed-off-by: Anda Xu <anda.xu@docker.com>
2018-08-19 14:58:23 -07:00
Daniel Hiltgen
896d1b1c61 Expose license status in Info (#37612)
* Expose license status in Info

This wires up a new field in the Info payload that exposes the license.
For moby this is hardcoded to always report a community edition.
Downstream enterprise dockerd will have additional licensing logic wired
into this function to report details about the current license status.

Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>

* Code review comments

Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>

* Add windows autogen support

Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
2018-08-17 17:05:21 -07:00
John Stephens
8613b34a7e
Merge pull request #37659 from Microsoft/jjh/37356
LCOW: Mount to short container paths to avoid command-line length limit
2018-08-17 15:48:35 -07:00
John Stephens
b3e9f7b13b
Merge pull request #35521 from salah-khan/35507
Add --chown flag support for ADD/COPY commands for Windows
2018-08-17 11:31:16 -07:00
Brian Goff
a351b38e72 Add new local log driver
This driver uses protobuf to store log messages and has better defaults
for log file handling (e.g. compression and file rotation enabled by
default).

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-08-17 09:36:56 -07:00
John Howard
dffc966165 LCOW: Capture stderr on external process. Log actual error rather than throwaway
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-08-16 19:20:14 -07:00
John Howard
f586fe5637 LCOW: Mount to short container paths to avoid command-line length limit
Signed-off-by: John Howard <jhoward@microsoft.com>

Fixes #36764

@johnstep PTAL. @jterry75 FYI.

There are two commits in this PR. The first ensure that errors are actually returned to the caller - it was being thrown away.

The second commit changes the LCOW driver to map, on a per service VM basis, "long" container paths such as `/tmp/c8fa0ae1b348f505df2707060f6a49e63280d71b83b7936935c827e2e9bde16d` to much shorter paths, based on a per-service VM counter, so something more like /tmp/d3. This means that the root cause of the failure where the mount call to create the overlay was failing due to command line length becomes something much shorter such as below.

`mount -t overlay overlay -olowerdir=/tmp/d3:/tmp/d4:/tmp/d5:/tmp/d6:/tmp/d7:/tmp/d8:/tmp/d9:/tmp/d10:/tmp/d11:/tmp/d12:/tmp/d13:/tmp/d14:/tmp/d15:/tmp/d16:/tmp/d17:/tmp/d18:/tmp/d19:/tmp/d20:/tmp/d21:/tmp/d22:/tmp/d23:/tmp/d24:/tmp/d25:/tmp/d26:/tmp/d27:/tmp/d28:/tmp/d29:/tmp/d30:/tmp/d31:/tmp/d32:/tmp/d33:/tmp/d34:/tmp/d35:/tmp/d36:/tmp/d37:/tmp/d38:/tmp/d39:/tmp/d40:/tmp/d41:/tmp/d42:/tmp/d43:/tmp/d44:/tmp/d45:/tmp/d46:/tmp/d47:/tmp/d48:/tmp/d49:/tmp/d50:/tmp/d51:/tmp/d52:/tmp/d53:/tmp/d54:/tmp/d55:/tmp/d56:/tmp/d57:/tmp/d58:/tmp/d59:/tmp/d60:/tmp/d61:/tmp/d62,upperdir=/tmp/d2/upper,workdir=/tmp/d2/work /tmp/c8fa0ae1b348f505df2707060f6a49e63280d71b83b7936935c827e2e9bde16d-mount`

For those worrying about overflow (which I'm sure @thaJeztah will mention...): It's safe to use a counter here as SVMs are disposable in the default configuration. The exception is when running the daemon in unsafe LCOW "global" mode (ie `--storage-opt lcow.globalmode=1`) where the SVMs aren't disposed of, but a single one is reused. However, to overflow the command line length, it would require several hundred-thousand trillion (conservative, I should sit down and work it out accurately if I get -really- bored) of SCSI hot-add operations, and even to hit that would be hard as just running containers normally uses the VPMEM path for the containers UVM, not to the global SVM on SCSI. It gets incremented by one per build step (commit more accurately) as a general rule. Hence it would be necessary to have to be doing automated builds without restarting the daemon for literally years on end in unsafe mode. 😇

Note that in reality, the previous limit of ~47 layers before hitting the command line length limit is close to what is possible in the platform, at least as of RS5/Windows Server 2019 where, in the HCS v1 schema, a single SCSI controller is used, and that can only support 64 disks per controller per the Hyper-V VDEV. And remember we have one slot taken up for the SVMs scratch, and another for the containers scratch when committing a layer. So the best you can architecturally get on the platform is around the following (it's also different by 1 depending on whether in unsafe or default mode)

```
PS E:\docker\build\36764\short> docker build --no-cache .
Sending build context to Docker daemon  2.048kB
Step 1/4 : FROM alpine as first
 ---> 11cd0b38bc3c
Step 2/4 : RUN echo test > /test
 ---> Running in 8ddfe20e5bfb
Removing intermediate container 8ddfe20e5bfb
 ---> b0103a00b1c9
Step 3/4 : FROM alpine
 ---> 11cd0b38bc3c
Step 4/4 : COPY --from=first /test /test
 ---> 54bfae391eba
Successfully built 54bfae391eba
PS E:\docker\build\36764\short> cd ..
PS E:\docker\build\36764> docker build --no-cache .
Sending build context to Docker daemon  4.689MB
Step 1/61 : FROM alpine as first
 ---> 11cd0b38bc3c
Step 2/61 : RUN echo test > /test
 ---> Running in 02597ff870db
Removing intermediate container 02597ff870db
 ---> 3096de6fc454
Step 3/61 : RUN echo test > /test
 ---> Running in 9a8110f4ff19
Removing intermediate container 9a8110f4ff19
 ---> 7691808cf28e
Step 4/61 : RUN echo test > /test
 ---> Running in 9afb8f51510b
Removing intermediate container 9afb8f51510b
 ---> e42a0df2bb1c
Step 5/61 : RUN echo test > /test
 ---> Running in fe977ed6804e
Removing intermediate container fe977ed6804e
 ---> 55850c9b0479
Step 6/61 : RUN echo test > /test
 ---> Running in be65cbfad172
Removing intermediate container be65cbfad172
 ---> 0cf8acba70f0
Step 7/61 : RUN echo test > /test
 ---> Running in fd5b0907b6a9
Removing intermediate container fd5b0907b6a9
 ---> 257a4493d85d
Step 8/61 : RUN echo test > /test
 ---> Running in f7ca0ffd9076
Removing intermediate container f7ca0ffd9076
 ---> 3baa6f4fa2d5
Step 9/61 : RUN echo test > /test
 ---> Running in 5146814d4727
Removing intermediate container 5146814d4727
 ---> 485b9d5cf228
Step 10/61 : RUN echo test > /test
 ---> Running in a090eec1b743
Removing intermediate container a090eec1b743
 ---> a7eb10155b51
Step 11/61 : RUN echo test > /test
 ---> Running in 942660b288df
Removing intermediate container 942660b288df
 ---> 9d286a1e2133
Step 12/61 : RUN echo test > /test
 ---> Running in c3d369aa91df
Removing intermediate container c3d369aa91df
 ---> f78be4788992
Step 13/61 : RUN echo test > /test
 ---> Running in a03c3ac6888f
Removing intermediate container a03c3ac6888f
 ---> 6504363f61ab
Step 14/61 : RUN echo test > /test
 ---> Running in 0c3c2fca3f90
Removing intermediate container 0c3c2fca3f90
 ---> fe3448b8bb29
Step 15/61 : RUN echo test > /test
 ---> Running in 828d51c76d3b
Removing intermediate container 828d51c76d3b
 ---> 870684e3aea0
Step 16/61 : RUN echo test > /test
 ---> Running in 59a2f7c5f3ad
Removing intermediate container 59a2f7c5f3ad
 ---> cf84556ca5c0
Step 17/61 : RUN echo test > /test
 ---> Running in bfb4e088eeb3
Removing intermediate container bfb4e088eeb3
 ---> 9c8f9f652cef
Step 18/61 : RUN echo test > /test
 ---> Running in f1b88bb5a2d7
Removing intermediate container f1b88bb5a2d7
 ---> a6233ad21648
Step 19/61 : RUN echo test > /test
 ---> Running in 45f70577d709
Removing intermediate container 45f70577d709
 ---> 1b5cc52d370d
Step 20/61 : RUN echo test > /test
 ---> Running in 2ce231d5043d
Removing intermediate container 2ce231d5043d
 ---> 4a0e17cbebaa
Step 21/61 : RUN echo test > /test
 ---> Running in 52e4b0928f1f
Removing intermediate container 52e4b0928f1f
 ---> 99b50e989bcb
Step 22/61 : RUN echo test > /test
 ---> Running in f7ba3da7460d
Removing intermediate container f7ba3da7460d
 ---> bfa3cad88285
Step 23/61 : RUN echo test > /test
 ---> Running in 60180bf60f88
Removing intermediate container 60180bf60f88
 ---> fe7271988bcb
Step 24/61 : RUN echo test > /test
 ---> Running in 20324d396531
Removing intermediate container 20324d396531
 ---> e930bc039128
Step 25/61 : RUN echo test > /test
 ---> Running in b3ac70fd4404
Removing intermediate container b3ac70fd4404
 ---> 39d0a11ea6d8
Step 26/61 : RUN echo test > /test
 ---> Running in 0193267d3787
Removing intermediate container 0193267d3787
 ---> 8062d7aab0a5
Step 27/61 : RUN echo test > /test
 ---> Running in f41f45fb7985
Removing intermediate container f41f45fb7985
 ---> 1f5f18f2315b
Step 28/61 : RUN echo test > /test
 ---> Running in 90dd09c63d6e
Removing intermediate container 90dd09c63d6e
 ---> 02f0a1141f11
Step 29/61 : RUN echo test > /test
 ---> Running in c557e5386e0a
Removing intermediate container c557e5386e0a
 ---> dbcd6fb1f6f4
Step 30/61 : RUN echo test > /test
 ---> Running in 65369385d855
Removing intermediate container 65369385d855
 ---> e6e9058a0650
Step 31/61 : RUN echo test > /test
 ---> Running in d861fcc388fd
Removing intermediate container d861fcc388fd
 ---> 6e4c2c0f741f
Step 32/61 : RUN echo test > /test
 ---> Running in 1483962b7e1c
Removing intermediate container 1483962b7e1c
 ---> cf8f142aa055
Step 33/61 : RUN echo test > /test
 ---> Running in 5868934816c1
Removing intermediate container 5868934816c1
 ---> d5ff87cdc204
Step 34/61 : RUN echo test > /test
 ---> Running in e057f3201f3a
Removing intermediate container e057f3201f3a
 ---> b4031b7ab4ac
Step 35/61 : RUN echo test > /test
 ---> Running in 22b769b9079c
Removing intermediate container 22b769b9079c
 ---> 019d898510b6
Step 36/61 : RUN echo test > /test
 ---> Running in f1d364ef4ff8
Removing intermediate container f1d364ef4ff8
 ---> 9525cafdf04d
Step 37/61 : RUN echo test > /test
 ---> Running in 5bf505b8bdcc
Removing intermediate container 5bf505b8bdcc
 ---> cd5002b33bfd
Step 38/61 : RUN echo test > /test
 ---> Running in be24a921945c
Removing intermediate container be24a921945c
 ---> 8675db44d1b7
Step 39/61 : RUN echo test > /test
 ---> Running in 352dc6beef3d
Removing intermediate container 352dc6beef3d
 ---> 0ab0ece43c71
Step 40/61 : RUN echo test > /test
 ---> Running in eebde33e5d9b
Removing intermediate container eebde33e5d9b
 ---> 46ca4b0dfc03
Step 41/61 : RUN echo test > /test
 ---> Running in f920313a1e85
Removing intermediate container f920313a1e85
 ---> 7f3888414d58
Step 42/61 : RUN echo test > /test
 ---> Running in 10e2f4dc1ac7
Removing intermediate container 10e2f4dc1ac7
 ---> 14db9e15f2dc
Step 43/61 : RUN echo test > /test
 ---> Running in c849d6e89aa5
Removing intermediate container c849d6e89aa5
 ---> fdb770494dd6
Step 44/61 : RUN echo test > /test
 ---> Running in 419d1a8353db
Removing intermediate container 419d1a8353db
 ---> d12e9cf078be
Step 45/61 : RUN echo test > /test
 ---> Running in 0f1805263e4c
Removing intermediate container 0f1805263e4c
 ---> cd005e7b08a4
Step 46/61 : RUN echo test > /test
 ---> Running in 5bde05b46441
Removing intermediate container 5bde05b46441
 ---> 05aa426a3d4a
Step 47/61 : RUN echo test > /test
 ---> Running in 01ebc84bd1bc
Removing intermediate container 01ebc84bd1bc
 ---> 35d371fa4342
Step 48/61 : RUN echo test > /test
 ---> Running in 49f6c2f51dd4
Removing intermediate container 49f6c2f51dd4
 ---> 1090b5dfa130
Step 49/61 : RUN echo test > /test
 ---> Running in f8a9089cd725
Removing intermediate container f8a9089cd725
 ---> b2d0eec0716d
Step 50/61 : RUN echo test > /test
 ---> Running in a1697a0b2db0
Removing intermediate container a1697a0b2db0
 ---> 10d96ac8f497
Step 51/61 : RUN echo test > /test
 ---> Running in 33a2332c06eb
Removing intermediate container 33a2332c06eb
 ---> ba5bf5609c1c
Step 52/61 : RUN echo test > /test
 ---> Running in e8920392be0d
Removing intermediate container e8920392be0d
 ---> 5b3a95685c7e
Step 53/61 : RUN echo test > /test
 ---> Running in 4b9298587c65
Removing intermediate container 4b9298587c65
 ---> d4961a349141
Step 54/61 : RUN echo test > /test
 ---> Running in 8a0c960c2ba1
Removing intermediate container 8a0c960c2ba1
 ---> b413197fcfa2
Step 55/61 : RUN echo test > /test
 ---> Running in 536ee3b9596b
Removing intermediate container 536ee3b9596b
 ---> fc16b69b224a
Step 56/61 : RUN echo test > /test
 ---> Running in 8b817b8d7b59
Removing intermediate container 8b817b8d7b59
 ---> 2f0896400ff9
Step 57/61 : RUN echo test > /test
 ---> Running in ab0ed79ec3d4
Removing intermediate container ab0ed79ec3d4
 ---> b4fb420e736c
Step 58/61 : RUN echo test > /test
 ---> Running in 8548d7eead1f
Removing intermediate container 8548d7eead1f
 ---> 745103fd5a38
Step 59/61 : RUN echo test > /test
 ---> Running in 1980559ad5d6
Removing intermediate container 1980559ad5d6
 ---> 08c1c74a5618
Step 60/61 : FROM alpine
 ---> 11cd0b38bc3c
Step 61/61 : COPY --from=first /test /test
 ---> 67f053c66c27
Successfully built 67f053c66c27
PS E:\docker\build\36764>
```

Note also that subsequent error messages once you go beyond current platform limitations kind of suck (such as insufficient resources with a bunch of spew which is incomprehensible to most) and we could do better to detect this earlier in the daemon. That'll be for a (reasonably low-priority) follow-up though as and when I have time. Theoretically we *may*, if the platform doesn't require additional changes for RS5, be able to have bigger platform limits using the v2 schema with up to 127 VPMem devices, and the possibility to have multiple SCSI controllers per SVM/UVM. However, currently LCOW is using HCS v1 schema calls, and there's no plans to rewrite the graphdriver/libcontainerd components outside of the moving LCOW fully over to the containerd runtime/snapshotter using HCS v2 schema, which is still some time off fruition.

PS OK, while waiting for a full run to complete, I did get bored. Turns out it won't overflow line length as max(uint64) is 18446744073709551616 which would still be short enough at 127 layers, double the current platform limit. And I could always change it to hex or base36 to make it even shorter, or remove the 'd' from /tmp/dN. IOW, pretty sure no-one is going to hit the limit even if we could get the platform to 256 which is the current Hyper-V SCSI limit per VM (4x64), although PMEM at 127 would be the next immediate limit.
2018-08-16 19:18:55 -07:00
Sebastiaan van Stijn
4d62192646
Merge pull request #37149 from dmcgowan/split-libcontainerd
libcontainerd: split client and daemon supervision
2018-08-16 19:00:10 +02:00
Sebastiaan van Stijn
0a4f89566a
Merge pull request #37472 from thaJeztah/no_unknown
Do not return "<unknown>" in /info response
2018-08-16 14:56:31 +02:00
Sebastiaan van Stijn
678d4b3a6d
Merge pull request #37412 from AzureCR/naduggar/logissue
Select polling based watcher for docker log file watcher on Windows
2018-08-14 14:40:44 +02:00
Sebastiaan van Stijn
6f8d17dad3
Add unit test for swarm labels on containers
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-08-14 12:31:53 +02:00
Salahuddin Khan
763d839261 Add ADD/COPY --chown flag support to Windows
This implements chown support on Windows. Built-in accounts as well
as accounts included in the SAM database of the container are supported.

NOTE: IDPair is now named Identity and IDMappings is now named
IdentityMapping.

The following are valid examples:
ADD --chown=Guest . <some directory>
COPY --chown=Administrator . <some directory>
COPY --chown=Guests . <some directory>
COPY --chown=ContainerUser . <some directory>

On Windows an owner is only granted the permission to read the security
descriptor and read/write the discretionary access control list. This
fix also grants read/write and execute permissions to the owner.

Signed-off-by: Salahuddin Khan <salah@docker.com>
2018-08-13 21:59:11 -07:00
Brian Goff
94a10150f6 Decouple logfile from tailfile.
This makes it so consumers of `LogFile` should pass in how to get an
io.Reader to the requested number of lines to tail.

This is also much more efficient when tailing a large number of lines.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-08-10 21:02:19 -07:00
Kazuhiro Sera
1e49fdcafc Fix the several typos detected by github.com/client9/misspell
Signed-off-by: Kazuhiro Sera <seratch@gmail.com>
2018-08-09 00:45:00 +09:00
Derek McGowan
dd2e19ebd5
libcontainerd: split client and supervisor
Adds a supervisor package for starting and monitoring containerd.
Separates grpc connection allowing access from daemon.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-08-06 10:23:04 -07:00
Sebastiaan van Stijn
e1584514c1
Merge pull request #37485 from fcrisciani/resolv
Systemd-resolved proper handling
2018-08-01 14:52:33 +02:00
Kir Kolyshkin
2c6fbd864a loggerutils: fix a typo
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-07-31 15:44:46 +03:00
Sebastiaan van Stijn
7b46fbc17a
Merge pull request #37462 from cwgem/37453_slash_prefix_removal
Remove slash prefix when matching name filters (Fixes #37453)
2018-07-30 13:17:40 +02:00
Flavio Crisciani
e353e7e3f0
Fixes for resolv.conf
Handle the case of systemd-resolved, and if in place
use a different resolv.conf source.
Set appropriately the option on libnetwork.
Move unix specific code to container_operation_unix

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-07-26 11:17:56 -07:00
Derek McGowan
8fb5f4d5c9
Add configuration option for containerd cri
Disable cri plugin by default in containerd and
allows an option to enable the plugin. This only
has an effect on containerd when supervised by
dockerd. When containerd is managed outside of
dockerd, the configuration is not effected.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-07-24 11:34:47 -07:00
Sebastiaan van Stijn
e6e8ab50fa
Do not return "<unknown>" in /info response
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-16 16:09:58 +02:00
Chris White
5c8da2e967 Remove slash prefix when matching name filters (Fixes #37453)
* Regex name filters were display undesired behavior due to
  names containing the trailing slash when being compared
* Adjusted filterByNameIDMatches and includeContainerInList to
  strip the slash prefix before doing name comparisons
* Added test case and helper functions for the test to list_test
* Force failed tests during development to ensure there were
  no false positives

Signed-off-by: Chris White <me@cwprogram.com>
2018-07-15 05:57:29 -05:00
Tibor Vass
a2a1d04bca
Merge pull request #37451 from thaJeztah/refactor_system_info
Refactor daemon.info to reduce cyclomatic complexity
2018-07-13 16:47:28 -07:00
Sebastiaan van Stijn
c03d3a416b
Unexport daemon.FillPlatformInfo
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-13 13:16:34 +02:00
Sebastiaan van Stijn
50eaed4d0c
Refactor daemon.info to reduce cyclomatic complexity
Before this change;

    gocyclo daemon/info.go
    17 daemon (*Daemon).SystemInfo daemon/info.go:27:1
    2 daemon (*Daemon).SystemVersion daemon/info.go:150:1
    1 daemon (*Daemon).showPluginsInfo daemon/info.go:195:1

After this change;

    gocyclo daemon/info.go
    8 daemon (*Daemon).fillSecurityOptions daemon/info.go:150:1
    5 daemon operatingSystem daemon/info.go:201:1
    3 daemon (*Daemon).fillDriverInfo daemon/info.go:121:1
    2 daemon hostName daemon/info.go:172:1
    2 daemon memInfo daemon/info.go:192:1
    2 daemon kernelVersion daemon/info.go:182:1
    1 daemon (*Daemon).SystemVersion daemon/info.go:81:1
    1 daemon (*Daemon).SystemInfo daemon/info.go:27:1
    1 daemon (*Daemon).fillPluginsInfo daemon/info.go:138:1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-13 13:10:05 +02:00
Kir Kolyshkin
b7a95a3ce4 lcow: fix debug in startServiceVMIfNotRunning()
When go-1.11beta1 is used for building, the following error is
reported:

> 14:56:20 daemon\graphdriver\lcow\lcow.go:236: Debugf format %s reads
> arg #2, but call has 1 arg

While fixing this, let's also fix a few other things in this
very function (startServiceVMIfNotRunning):

1. Do not use fmt.Printf when not required.
2. Use `title` whenever possible.
3. Don't add `id` to messages as `title` already has it.
4. Remove duplicated colons.
5. Try to unify style of messages.
6. s/startservicevmifnotrunning/startServiceVMIfNotRunning/
...

In general, logging/debugging here is a mess and requires much more
love than I can give it at the moment. Areas for improvement:

1. Add a global var logger = logrus.WithField("storage-driver", "lcow")
and use it everywhere else in the code.
2. Use logger.WithField("id", id) whenever possible (same for "context"
and other similar fields).
3. Revise all the errors returned to be uniform.
4. Make use of errors.Wrap[f] whenever possible.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-07-12 13:42:23 -07:00
Kir Kolyshkin
09ad434f10
loggerutils: build fixes, improve errors
There are two build errors when using go-1.11beta1:

> daemon/logger/loggerutils/logfile.go:367: Warningf format %q arg f.Name is a func value, not called
> daemon/logger/loggerutils/logfile.go:564: Debug call has possible formatting directive %v

In the first place, the file name is actually not required as error
message already includes it.

While at it, fix a couple of other places for more correct messages, and
make sure to not add a file name if an error already has it.

Fixes: f69f09f44c
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-11 15:52:25 +02:00
Kir Kolyshkin
2e30e9e6db
aufs: fix Wrapf args
Fix the following go-1.11beta1 build error:

> daemon/graphdriver/aufs/aufs.go:376: Wrapf format %s reads arg #1, but call has 0 args

While at it, change '%s' to %q.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-11 15:52:22 +02:00
Kir Kolyshkin
a9a136572d
Compile fix
Go 1.11beta1 (rightfully) complains:

> 15:38:37 daemon/cluster/controllers/plugin/controller.go:183:
> Entry.Debugf format %#T has unrecognized flag #

This debug print was added by commit 72c3bcf2a5.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-11 15:52:19 +02:00
Sebastiaan van Stijn
3737194b9f
daemon/*.go: fix some Wrap[f]/Warn[f] errors
In particular, these two:
> daemon/daemon_unix.go:1129: Wrapf format %v reads arg #1, but call has 0 args
> daemon/kill.go:111: Warn call has possible formatting directive %s

and a few more.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-11 15:51:51 +02:00
Tejaswini Duggaraju
df84cdd091 Select polling based watcher for Windows log watcher
Signed-off-by: Tejaswini Duggaraju <naduggar@microsoft.com>
2018-07-10 10:20:10 -07:00
Sebastiaan van Stijn
328c089b5b
Merge pull request #37372 from ctelfer/scalable-lb
Improve scalability of the Linux load balancing
2018-07-09 20:06:37 +02:00
Chris Telfer
6225d1f15c Get err type in removeNetworks() w/ errors.Cause()
Commit c0bc14e8 wrapped the return value of nw.Delete() with some extra
information.  However, this breaks the code in
containerAdaptor.removeNetworks() which ignores certain specific
libnetwork error return codes.  Said codes actually don't represent
errors, but just regular conditions to be expected in normal operation.
The removeNetworks() call checked for these errors by type assertions
which the errors.Wrap(err...) breaks.

This has a cascading effect, because controller.Remove() invokes
containerAdaptor.removeNetworks() and if the latter returns an error,
then Remove() fails to remove the container itself.  This is not
necessarily catastrophic since the container reaper apparently will
purge the container later, but it is clearly not the behavior we want.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-07-07 18:18:53 -04:00
Chris Telfer
8e0f6bc903 Update moby to use scalable-lb libnetwork APIs
This patch is required for the updated version of libnetwork and entails
two minor changes.

First, it uses the new libnetwork.NetworkDeleteOptionRemoveLB option to
the network.Delete() method to automatically remove the load balancing
endpoint for ingress networks.   This allows removal of the
deleteLoadBalancerSandbox() function whose functionality is now within
libnetwork.

The second change is to allocate a load balancer endpoint IP address for
all overlay networks rather than just "ingress" and windows overlay
networks.  Swarmkit is already performing this allocation, but moby was
not making use of these IP addresses for Linux overlay networks (except
ingress).  The current version of libnetwork makes use of these IP
addresses by creating a load balancing sandbox and endpoint similar to
ingress's  for all overlay network and putting all load balancing state
for a given node in that sandbox only.  This reduces the amount of linux
kernel state required per node.

In the prior scheme, libnetwork would program each container's network
namespace with every piece of load balancing state for every other
container that shared *any* network with the first container.  This
meant that the amount of kernel state on a given node scaled with the
square of the number of services in the cluster and with the square of
the number of containers per service.  With the new scheme, kernel state
at each node scales linearly with the number of services and the number
of containers per service.  This also reduces the number of system calls
required to add or remove tasks and containers.  Previously the number
of system calls required grew linearly with the number of other
tasks that shared a network with the container.  Now the number of
system calls grows linearly only with the number of networks that the
task/container is attached to.  This results in a significant
performance improvement when adding and removing services to a cluster
that already heavily loaded.

The primary disadvantage to this scheme is that it requires the
allocation of an additional IP address per node per subnet for every
node in the cluster that has a task on the given subnet.  However, as
mentioned, swarmkit is already allocating these IP addresses for every
node and they are going unused.  Future swarmkit modifications should be
examined to only allocate said IP addresses when nodes actually require
them.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-07-03 13:46:33 -04:00
Brian Goff
1caeb79963 Fix bindmount autocreate race
When using the mounts API, bind mounts are not supposed to be
automatically created.

Before this patch there is a race condition between valiating that a
bind path exists and then actually setting up the bind mount where the
bind path may exist during validation but was removed during mountpooint
setup.

This adds a field to the mountpoint struct to ensure that binds created
over the mounts API are not accidentally created.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-07-02 13:42:33 -07:00
Sebastiaan van Stijn
8d1b280a25
Merge pull request #37374 from haikuoliu/branch_endpoint
Pass endpoint to the CloudWatch Logs logging driver
2018-06-30 11:22:55 +02:00
haikuoliu
998478d369 Pass endpoint to the CloudWatch Logs logging driver
Signed-off-by: haikuoliu <haikuo@amazon.com>
2018-06-29 11:27:37 -07:00
Sebastiaan van Stijn
d912e9460e
Merge pull request #37156 from cpuguy83/networking_api_types_only
Move network conversions out of API router
2018-06-29 02:47:27 +02:00
Brian Goff
c0bc14e8dd Move network conversions out of API router
This stuff doesn't belong here and is causing imports of libnetwork into
the router, which is not what we want.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-06-27 17:11:29 -07:00
Tonis Tiigi
337ba71fc1 distribution: fix passing platform struct to puller
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-27 14:59:31 -07:00
John Howard
35193c0e7d LCOW: Auto-select OS
Signed-off-by: John Howard <jhoward@microsoft.com>

Addresses https://github.com/moby/moby/pull/35089#issuecomment-367802698.
This change enables the daemon to automatically select an image under LCOW
that can be used if the API doesn't specify an explicit platform.

For example:

FROM supertest2014/nyan
ADD Dockerfile /

And docker build . will download the linux image (not a multi-manifest image)

And similarly docker pull ubuntu will match linux/amd64
2018-06-26 11:37:43 -07:00
Tibor Vass
093424bec0
Merge pull request #37313 from dmcgowan/fix-overlay2-changes
Update overlay2 to use naive diff for changes
2018-06-20 17:16:06 -07:00
Derek McGowan
ac5d363e67
Update overlay2 to use naive diff for changes
The archive changes function is not implemented correctly
to handle opaque directories.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-06-20 11:07:36 -07:00
John Starks
e9268d9642 lcow: Allow the client to add device cgroup rules
Signed-off-by: John Starks <jostarks@microsoft.com>
2018-06-15 16:14:17 -07:00
John Starks
349aeeab7c lcow: Allow the client to add or remove capabilities
Signed-off-by: John Starks <jostarks@microsoft.com>
2018-06-15 16:03:33 -07:00
Vincent Demeester
3845728524
Update tests to use gotest.tools 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-13 09:04:30 +02:00
Tonis Tiigi
157b0b30db builder: lint fixes
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-10 10:05:29 -07:00
Tonis Tiigi
ea36c3cbaf daemon: access to distribution internals
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-10 10:05:26 -07:00
Tonis Tiigi
44f3dd7653 vendor: update containerd to 63522d9
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-08 19:19:06 -07:00
Sebastiaan van Stijn
5e11f66cb6
Merge pull request #37172 from zq-david-wang/resizefix2
Fix race condition between exec start and resize.
2018-06-08 15:43:25 -07:00
Sebastiaan van Stijn
5cb95f693d
Merge pull request #37184 from cpuguy83/attach_leak
Fix fd leak on attach
2018-06-08 13:08:06 -07:00
Sebastiaan van Stijn
a7b6643c5f
Merge pull request #36161 from fanjiyun/edit
When link id is empty for overlay2, do not remove this link.
2018-06-08 09:12:22 -07:00
Tõnis Tiigi
4703b284e6
Merge pull request #37233 from dnephin/add-metrics-for-pull
Add image metrics for push and pull
2018-06-08 00:26:12 -07:00
David Wang
e6783656f9 Fix race condition between exec start and resize
Signed-off-by: David Wang <00107082@163.com>
2018-06-08 11:07:48 +08:00
fanjiyun
0e8f96e317
When id is empty for overlay2/overlay, do not remove the directories.
Signed-off-by: fanjiyun <fan.jiyun@zte.com.cn>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-07 17:35:54 -07:00
Daniel Nephin
6910019bbe Add image metrics for push and pull
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2018-06-07 18:26:12 -04:00
Vincent Demeester
e401b88e59
Add support for init on services
It's already supported by `swarmkit`, and act the same as
`HostConfig.Init` on container creation.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-07 14:17:55 +02:00
Jess Frazelle
3694c1e34e
api: add configurable MaskedPaths and ReadOnlyPaths to the API
This adds MaskedPaths and ReadOnlyPaths options to HostConfig for containers so
that a user can override the default values.

When the value sent through the API is nil the default is used.
Otherwise the default is overridden.

Adds integration tests for MaskedPaths and ReadonlyPaths.

Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
2018-06-05 12:33:14 -04:00
Sebastiaan van Stijn
5037c5a8ce
Merge pull request #36688 from cpuguy83/volumes_service
Extract volume interaction to a volumes service
2018-06-05 02:16:20 +02:00
Brian Goff
0f51477017 Fix fd leak on attach
With a full attach, each attach was leaking 4 goroutines.
This updates attach to use errgroup instead of the hodge-podge of
waitgroups and channels.

In addition, the detach event was never being sent.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-05-31 10:11:18 -04:00
Brian Goff
7c77df8acc Move plugin client to separate interface
This makes it a bit simpler to remove this interface for v2 plugins
and not break external projects (libnetwork and swarmkit).

Note that before we remove the `Client()` interface from `CompatPlugin`
libnetwork and swarmkit must be updated to explicitly check for the v1
client interface as is done int his PR.

This is just a minor tweak that I realized is needed after trying to
implement the needed changes on libnetwork.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-05-30 15:22:10 -04:00
Brian Goff
b85799b63f
Merge pull request #36874 from kolyshkin/stop-timeout
daemon.ContainerStop(): fix for a negative timeout
2018-05-30 13:38:42 -04:00
Anusha Ragunathan
cbbe0ff511
Merge pull request #37017 from cpuguy83/plugins_addr
Move plugin client creation to the extension point
2018-05-30 09:54:46 -07:00
Sebastiaan van Stijn
65bd038fc5
Merge pull request #37131 from kolyshkin/top-opt
Optimize ContainerTop() aka docker top
2018-05-30 03:28:07 +02:00
Brian Goff
f51a96c016 Move plugin client creation to the extension point
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-05-25 15:18:53 -04:00
Brian Goff
e4b6adc88e Extract volume interaction to a volumes service
This cleans up some of the package API's used for interacting with
volumes, and simplifies management.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-05-25 14:21:07 -04:00
Kir Kolyshkin
a41328d570 ContainerTop: improve error message
If "ps" fails, in many cases it prints a meaningful error message
which a user can benefit from. Let's use it.

While at it, let's use errdefs.System to classify the error,
as well as errors.Wrap.

Before:

> $ docker top $CT <any bad ps options>
> Error response from daemon: Error running ps: exit status 1

After:

> $ docker top $CT auxm
> Error response from daemon: ps: error: thread display conflicts with forest display

or

> $ docker top $CT saur
> Error response from daemon: ps: error: conflicting format options

or, if there's no meaningful error on stderr, same as before:

> $ docker top $CT 1234
> Error response from daemon: ps: exit status 1

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-05-24 18:24:36 -07:00
Kir Kolyshkin
a076badb8b ContainerTop: speed up
Current ContainerTop (a.k.a. docker top) implementation uses "ps"
to get the info about *all* running processes, then parses it, then
filters the results to only contain PIDs used by the container.
Collecting data only to throw most of it away is inefficient,
especially on a system running many containers (or processes).
For example, "docker top" on a container with a single process
can take up to 0.5 seconds to execute (on a mostly idle system)
which is noticeably slow.

Since the containers PIDs are known beforehand, let's use ps's
"-q" option to provide it with a list of PIDs we want info about.

The problem with this approach is, some ps options can't be used
with "-q" (the only one I'm aware of is "f" ("forest view") but
there might be more). As the list of such options is not known,
in case ps fails, it is executed again without "q" (retaining
the old behavior).

Next, the data produced by "ps" is filtered in the same way as before.
The difference here is, in case "-q" worked, the list is much shorter.

I ran some benchmarks on my laptop, with about 8000 "sleep" processes
running to amplify the savings.

The improvement in "docker top" execution times is 5x to 10x (roughly
0.05s vs 0.5s).

The improvement in ContainerTop() execution time is up to 100x
(roughly 3ms vs 300ms).

I haven't measured the memory or the CPU time savings, guess those
are not that critical.

NOTE that busybox ps does not implement -q so the fallback is always
used, but AFAIK it is not usable anyway and Docker expects a normal
ps to be on the system (say the list of fields produced by
"busybox ps -ef" differs from normal "ps -ef" etc.).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-05-24 18:24:27 -07:00
Sebastiaan van Stijn
80bfcc3a7a
Merge pull request #37136 from muesli/sdnotify-api-const
Use go-systemd const instead of magic string in Linux version of dockerd
2018-05-24 14:30:28 +02:00
Sebastiaan van Stijn
8e2f920306
Merge pull request #37108 from thaJeztah/remove_unneeded_aliases
Various code-cleanup
2018-05-24 01:38:56 +02:00
Christian Muehlhaeuser
703c3c5735
Adapt listeners to upstream API changes in go-systemd
Signed-off-by: Christian Muehlhaeuser <muesli@gmail.com>
2018-05-23 21:57:30 +02:00
Sebastiaan van Stijn
f23c00d870
Various code-cleanup
remove unnescessary import aliases, brackets, and so on.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-05-23 17:50:54 +02:00
Kir Kolyshkin
654a7625fc daemon/parsePsOutput: minor optimisation
It does not make sense to keep looking for PID once
we found it, so let's give it a break.

The side effect of this patch is, if there's more than one column
titled "PID", the last (rightmost) column was used before, and now
the first (leftmost) column is used. Should make no practical
difference whatsoever.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-05-22 16:24:13 -07:00
Drew Erny
5b69ff466e
Output network attachment task information
Adds functionality to parse and return network attachment spec
information. Network attachment tasks are phony tasks created in
swarmkit to deal with unmanaged containers attached to swarmkit. Before
this change, attempting `docker inspect` on the task id of a network
attachment task would result in an empty task object. After this change,
a full task object is returned

Fixes #26548 the correct way.

Signed-off-by: Drew Erny <drew.erny@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-05-22 23:36:30 +02:00
Kir Kolyshkin
16670ed484 daemon unit tests: skip some if non-root
This prevents the following test case failures "go test" is run
as non-root in the daemon/ directory:

> --- FAIL: TestContainerInitDNS (0.02s)
> 	daemon_test.go:209: chown /tmp/docker-container-test-054812199/volumes: operation not permitted
>
> --- FAIL: TestDaemonReloadNetworkDiagnosticPort (0.00s)
>	reload_test.go:525: mkdir /var/lib/docker/network/files/: permission denied
> --- FAIL: TestRootMountCleanup (0.00s)
> 	daemon_linux_test.go:240: assertion failed: error is not nil: operation not permitted

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-05-22 13:12:29 -07:00
Yong Tang
9bd5d9912f
Merge pull request #37110 from thaJeztah/remove-testutil-errorcontains
Replace deprecated testutil.ErrorContains()
2018-05-21 11:04:45 -07:00
Sebastiaan van Stijn
55bebbaecf
Replace deprecated testutil.ErrorContains()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-05-21 00:13:04 +02:00
Kir Kolyshkin
91f85d1c78
aufs: log reason why aufs is not supported.
In case aufs driver is not supported because supportsAufs() said so,
it is not possible to get a real reason from the logs.

To fix, log the error returned.

Note we're not using WithError here as the error message itself is the
sole message we want to print (i.e. there's nothing to add to it).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-05-20 12:02:41 +02:00
Kir Kolyshkin
c6e2af5425
aufs: use a single logger
Simplify the code by using a single logger instance.

While at it, use WithError in Umount.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-05-20 12:02:12 +02:00
Sebastiaan van Stijn
f9dd74deee
Merge pull request #37022 from cgxu519/overlayutils-addmsg
Add additional message when backendfs is extfs without d_type support
2018-05-19 22:38:45 +02:00
Sebastiaan van Stijn
3646562a5c
Merge pull request #37088 from ohbarye/fix-typos-duplicated-the
Fix typos: remove duplicated "the"
2018-05-19 20:57:47 +02:00
Tibor Vass
1b75e17584
Merge pull request #37091 from thaJeztah/fix-linting-errors
Fix some linting issues
2018-05-19 08:39:39 -10:00
Chengguang Xu
8a21b128d4 Add additional message when backendfs is extfs without d_type support
ext4 support d_type by default, but filetype feature is a tunable so
there is still a chance to disable it for some reasons. In this case,
print additional message to explicitly tell how to support d_type.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
2018-05-18 10:32:47 +08:00
Anusha Ragunathan
59698778fe
Merge pull request #37084 from nwneisen/update-ring-buffer-documents
Update documentation for RingLogger's ring buffer
2018-05-17 12:10:44 -07:00
Sebastiaan van Stijn
4f8c870d62
Fix some linting issues
These showed locally when running `make validate`. CI doesn't seem to have the
same (possibly it's disabled in the configuration)

    builder/fscache/fscache.go:618::error: github.com/docker/docker/vendor/github.com/tonistiigi/fsutil.StatInfo composite literal uses unkeyed fields (vet)
    client/swarm_unlock_test.go:44::error: github.com/docker/docker/api/types/swarm.UnlockRequest composite literal uses unkeyed fields (vet)
    client/swarm_unlock_test.go:20::error: github.com/docker/docker/api/types/swarm.UnlockRequest composite literal uses unkeyed fields (vet)
    cmd/dockerd/daemon_unix.go:113::error: github.com/docker/docker/cmd/dockerd/hack.MalformedHostHeaderOverride composite literal uses unkeyed fields (vet)
    cmd/dockerd/daemon_unix.go:110::error: github.com/docker/docker/cmd/dockerd/hack.MalformedHostHeaderOverride composite literal uses unkeyed fields (vet)
    daemon/graphdriver/overlay/overlay.go:171::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
    daemon/graphdriver/overlay/overlay.go:413::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
    daemon/graphdriver/overlay2/overlay.go:203::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
    daemon/graphdriver/overlay2/overlay.go:584::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
    daemon/graphdriver/zfs/zfs.go:109::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
    daemon/graphdriver/zfs/zfs.go:388::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
    daemon/volumes_windows.go:27::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
    integration/service/network_test.go:31::error: github.com/docker/docker/api/types/network.NetworkingConfig composite literal uses unkeyed fields (vet)
    api/server/server.go:129:10⚠️ should not use basic type string as key in context.WithValue (golint)
    integration/service/network_test.go:54::error: github.com/docker/docker/api/types/network.NetworkingConfig composite literal uses unkeyed fields (vet)
    libcontainerd/client_daemon_linux.go:61::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
    libcontainerd/client_daemon_linux.go:74::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
    pkg/archive/archive_windows.go:76::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
    plugin/manager_linux.go:56::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-05-17 19:28:27 +02:00
Vincent Demeester
9aac187ce1
Merge pull request #37075 from tuscloud/fix-typos
Fix typos
2018-05-17 16:00:43 +02:00
ohbarye
0f95b23d98 Fix typos: remove duplicated "the"
Signed-off-by: Masato Ohba <over.rye@gmail.com>
2018-05-17 21:49:51 +09:00
Nick Neisen
3521d534e5 Update documentation for RingLogger's ring buffer
Signed-off-by: Nick Neisen <nwneisen@gmail.com>
2018-05-16 18:52:50 -06:00
weipeng
f781ec45b5 Fix typos
Signed-off-by: weipeng <weipeng@tuscloud.io>
2018-05-16 09:15:43 +08:00
Sebastiaan van Stijn
6821ffd1a1
Merge pull request #37028 from cpuguy83/log_plugin_broken_pipe
Fix logging plugin crash unrecoverable
2018-05-15 13:57:01 +02:00
Sebastiaan van Stijn
6f68db8c7a
Merge pull request #37033 from cpuguy83/some_container_network_cleanups
Some container/network cleanups
2018-05-15 13:23:41 +02:00
Sebastiaan van Stijn
07dc3aa685
Merge pull request #37062 from cpuguy83/fix_logs_daemon_race
Fix race conditions in logs API
2018-05-15 11:59:40 +02:00
Vincent Demeester
26da99e326
Merge pull request #37063 from cpuguy83/fix_log_rotation_issue
Fix some issues in logfile reader and rotation
2018-05-15 11:46:29 +02:00
Vincent Demeester
bcd86fc2ac
Merge pull request #37060 from cpuguy83/fix_swagger_gen
Fix swagger volume type generation
2018-05-15 11:46:02 +02:00
Brian Goff
e7479e3ab8 Fix logging plugin crash unrecoverable
In cases where a logging plugin has crashed when the daemon tries to
copy the container stdio to the logging plugin it returns a broken pipe
error and any log entries that occurr while the plugin is down are lost.

Fix this by opening read+write in the daemon so logs are not lost while
the plugin is down.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-05-14 16:51:56 -04:00
Brian Goff
e87e9e6ad6 Fix some issues in logfile reader and rotation
- Check errors.Cause(err) when comparing errors
- Fix bug where oldest log file is not actually removed. This in
particular causes issues when compression is enabled. On rotate it just
overwrites the data in the log file corrupting it.
- Use O_TRUNC to open new gzip files to ensure we don't corrupt log
files as happens without the above fix.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-05-14 15:52:18 -04:00
Brian Goff
2c252a48c2 Fix race conditions in logs API
Closing the log driver was in a defer meanwhile logs are
collected asyncronously, so the log driver was being closed before reads
were actually finished.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-05-14 15:48:32 -04:00
Brian Goff
b16b125bb4 Fix swagger volume type generation
This was broken by bf6a790f00

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-05-14 13:46:20 -04:00
Vincent Demeester
ab0dccf801
Merge pull request #37034 from cpuguy83/moar_metrics
Add metrics for log failures/partials
2018-05-14 18:05:30 +02:00