Commit Graph

2697 Commits

Author SHA1 Message Date
ddb553c9c7 pkg/archive:CopyTo(): fix for long dest filename
As reported in docker/for-linux/issues/484, since Docker 18.06
docker cp with a destination file name fails with the following error:

> archive/tar: cannot encode header: Format specifies USTAR; and USTAR cannot encode Name="a_very_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_long_filename_that_is_101_characters"

The problem is caused by changes in Go 1.10 archive/tar, which
mis-guesses the tar stream format as USTAR (rather than PAX),
which, in turn, leads to inability to specify file names
longer than 100 characters.

This tar stream is sent by TarWithOptions() (which, since we switched to
Go 1.10, explicitly sets format=PAX for every file, see FileInfoHeader(),
and before Go 1.10 it was PAX by default). Unfortunately, the receiving
side, RebaseArchiveEntries(), which calls tar.Next(), mistakenly guesses
header format as USTAR, which leads to the above error.

The fix is easy: set the format to PAX in RebaseArchiveEntries()
where we read the tar stream and change the file name.

A unit test is added to prevent future regressions.

NOTE this code is not used by dockerd, but rather but docker cli
(also possibly other clients), so this needs to be re-vendored
to cli in order to take effect.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit f55a4176febbd0dffd6e5eb65beb70bc32912d0b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 989e7f5d3a3f40ebb936376245b770f766ea42e9
Component: engine
2019-03-02 16:33:19 +01:00
2012f67a6d Merge pull request #143 from thaJeztah/18.09_backport_skip_kmem_tests_on_rhel
[18.09 backport] Skip kernel-memory tests on RHEL/CentOS daemons
Upstream-commit: 6b0ba3745d073717887ead912c3c7dea4c99fc45
Component: engine
2019-02-20 18:23:09 -08:00
ddcd7c106d Makes a few modifications to the name generator.
* Replaces `cocks` with `cerf` as the former might be perceived as
offensive by some people (as pointed out by @jeking3
[here](https://github.com/moby/moby/pull/37157#commitcomment-31758059))
* Removes a duplicate entry for `burnell`
* Re-arranges the entry for `sutherland` to ensure that the names are in
sorted order
* Adds entries for `shamir` and `wilbur`

Signed-off-by: Debayan De <debayande@users.noreply.github.com>
(cherry picked from commit e50f791d42d1167a5ef757b1aa179e84f0f81bba)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: a818442de73b16d8ad756c74e5e660d132e97848
Component: engine
2019-02-20 13:31:11 +01:00
58654c0a23 pkg/archive: fix TestTarUntarWithXattr failure on recent kernel
Recent kernel has strict check for security.capability value.
Fix #38289

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
(cherry picked from commit 9ddd6e47a90ac056d242969ff72bf75a43cc0004)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: d158b9e74fffe377b6acc7794246c89f9fb26d2f
Component: engine
2019-02-12 00:13:23 +01:00
006734c577 If url includes scheme, urlPath will drop hostname, which would not match the auth check
Signed-off-by: Jameson Hyde <jameson.hyde@docker.com>
(cherry picked from commit 754fb8d9d03895ae3ab60d2ad778152b0d835206)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: a79fabbfe84117696a19671f4aa88b82d0f64fc1
Component: engine
2019-01-09 17:31:53 +00:00
0b021f6648 Authz plugin security fixes for 0-length content and path validation Signed-off-by: Jameson Hyde <jameson.hyde@docker.com>
fix comments

(cherry picked from commit 9659c3a52bac57e615b5fb49b0652baca448643e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: fc274cd2ff4cf3b48c91697fb327dd1fb95588fb
Component: engine
2019-01-09 17:31:53 +00:00
f2977c7888 Skip kernel-memory tests on RHEL/CentOS daemons
RHEL/CentOS 3.10 kernels report that kernel-memory accounting is supported,
but it actually does not work.

Runc (when compiled for those kernels) will be compiled without kernel-memory
support, so even though the daemon may be reporting that it's supported,
it actually is not.

This cause tests to fail when testing against a daemon that's using a runc
version without kmem support.

For now, skip these tests based on the kernel version reported by the daemon.

This should fix failures such as:

```
FAIL: /go/src/github.com/docker/docker/integration-cli/docker_cli_run_unix_test.go:499: DockerSuite.TestRunWithKernelMemory

assertion failed:
Command:  /usr/bin/docker run --kernel-memory 50M --name test1 busybox cat /sys/fs/cgroup/memory/memory.kmem.limit_in_bytes
ExitCode: 0
Error:    <nil>
Stdout:   9223372036854771712

Stderr:   WARNING: You specified a kernel memory limit on a kernel older than 4.0. Kernel memory limits are experimental on older kernels, it won't work as expected and can cause your system to be unstable.

Failures:
Expected stdout to contain "52428800"

FAIL: /go/src/github.com/docker/docker/integration-cli/docker_cli_update_unix_test.go:125: DockerSuite.TestUpdateKernelMemory

/go/src/github.com/docker/docker/integration-cli/docker_cli_update_unix_test.go:136:
    ...open /go/src/github.com/docker/docker/integration-cli/docker_cli_update_unix_test.go: no such file or directory
... obtained string = "9223372036854771712"
... expected string = "104857600"

----------------------------------------------------------------------
FAIL: /go/src/github.com/docker/docker/integration-cli/docker_cli_update_unix_test.go:139: DockerSuite.TestUpdateKernelMemoryUninitialized

/go/src/github.com/docker/docker/integration-cli/docker_cli_update_unix_test.go:149:
    ...open /go/src/github.com/docker/docker/integration-cli/docker_cli_update_unix_test.go: no such file or directory
... value = nil
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 1e1156cf67233cf8eaee2da9c17465ff0d9c2aa0)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: e042692db1316a60be35bfdca10d7e08d20f50ad
Component: engine
2019-01-05 09:53:31 +01:00
50be23f5a1 fixes display text in Multiple IDs found with provided prefix
Signed-off-by: Lifubang <lifubang@acmcoder.com>
(cherry picked from commit 00eb3480dc4ceb6034f8f7463ff41d2e87fb5dcc)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 1043f40fb561ffbf23fbdde9989abcebd8e48279
Component: engine
2018-12-11 15:15:20 +01:00
c9df8f4688 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>
(cherry picked from commit 78045a5419718ba8884ed5afc0b41a3a80afc3b4)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: b66c7ad62ebff12112318db0d1ed48b14f817efa
Component: engine
2018-12-07 18:58:03 +01:00
de86551520 pkg/mount: add MakeMount()
This function ensures the argument is the mount point
(i.e. if it's not, it bind mounts it to itself).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 8abadb36fa8149cd44e76b0e7fdedd6f1f2eccd0)
Upstream-commit: 2199ada691dc635cac5cdd065d909a539dd0b793
Component: engine
2018-10-12 09:29:38 -07:00
0d643ed639 pkg/mount: simplify ensureMountedAs
1. There is no need to specify rw argument -- bind mounts are
   read-write by default.

2. There is no point in parsing /proc/self/mountinfo after performing
   a mount, especially if we don't check whether the fs is mounted or
   not -- the only outcome from it could be an error from our mountinfo
   parser, which makes no sense in this context.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit f01297d1ae352bc2bf01ebf62e879c1c83cdbee4)
Upstream-commit: fd7611ff1f1d61d5b4b45b2c0bd83976cbccf174
Component: engine
2018-10-12 09:29:38 -07:00
00c518411b 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>
(cherry picked from commit f8e876d7616469d07b8b049ecb48967eeb8fa7a5)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 0922d32bce74657266aff213f83dfa638e8077f4
Component: engine
2018-10-05 15:13:43 +02:00
27a6fe5146 pkg/progress: work around closing closed channel panic
I could not reproduce the panic in #37735, so here's a bandaid.

Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 7dac70324d0ce6acd23458b0bef06f099837d648)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 2c26eac56628527ed64c79ce9145ed97583cbeca
Component: engine
2018-09-17 12:28:09 +02:00
21c28e4566 pkg/filenotify/poller: fix Close()
The code in Close() that removes the watches was not working,
because it first sets `w.closed = true` and then calls w.close(),
which starts with
```
        if w.closed {
                return errPollerClosed
	}
```

Fix by setting w.closed only after calling w.remove() for all the
files being watched.

While at it, remove the duplicated `delete(w.watches, name)` code.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit fffa8958d00860b4e3563327a2cc6836a12d4ba9)
Upstream-commit: 4e2dbfa1af48191126b0910b9463bf94d8371886
Component: engine
2018-09-06 18:39:21 -07:00
abbd665e30 pkg/filenotify/poller: close file asap
There is no need to wait for up to 200ms in order to close
the file descriptor once the chClose is received.

This commit might reduce the chances for occasional "The process
cannot access the file because it is being used by another process"
error on Windows, where an opened file can't be removed.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit dfbb64ea7d042d5b2bb0c1c2b88e3682b7069b10)
Upstream-commit: 3a3bfcbf47e98212abfc9cfed860d9e99fc41cdc
Component: engine
2018-09-06 18:39:21 -07:00
42fda5fe7e pkg/filenotify: poller.Add: fix fd leaks on err
In case of errors, the file descriptor is never closed. Fix it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 88bcf1573ca2eaffc15da346a1651a3749567554)
Upstream-commit: 7be43586af6824c1e55cb502d9d2bab45c9b4505
Component: engine
2018-09-06 18:39:21 -07:00
d2993cf016 Merge pull request #37092 from cpuguy83/local_logger
Add "local" log driver
Upstream-commit: e0ad6d045c752e0523d8591b235ec2db32bc71fc
Component: engine
2018-08-20 07:01:41 +01:00
98e7273292 Merge pull request #35521 from salah-khan/35507
Add --chown flag support for ADD/COPY commands for Windows
Upstream-commit: b3e9f7b13b0f0c414fa6253e1f17a86b2cff68b5
Component: engine
2018-08-17 11:31:16 -07:00
588ae61588 Merge pull request #37600 from edrevo/conemu-fix
Fix #28814: use emulation for ConEmu and ConsoleZ
Upstream-commit: 74c43af1a3ba70a044971679c91c283ecf2b34df
Component: engine
2018-08-15 16:50:05 -07:00
7414934b6c 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>
Upstream-commit: 763d8392612942ff5c32a35f8bdafd7ae93d3321
Component: engine
2018-08-13 21:59:11 -07:00
96af87df0a Merge pull request #37443 from Projjol/new_names
Add in two new names for names-generator
Upstream-commit: 1fd7e4c28d3a4a21c3540f03a045f96a4190b527
Component: engine
2018-08-12 19:04:56 -07:00
2835149d80 Add func to get an io.Reader for tail operations
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 874867d4e575ef805d71759e703e4f11cce05bd3
Component: engine
2018-08-10 21:01:15 -07:00
a18736f217 Fix #28814
Signed-off-by: Ximo Guanter Gonzálbez <joaquin.guantergonzalbez@telefonica.com>
Upstream-commit: ea65a0b1349b532e9d10d63835c751d291a7c0f4
Component: engine
2018-08-07 10:20:13 +02:00
f4ebc73a60 Merge pull request #37465 from Russtopia/master
namesgenerator: new adjective, two inspiring Computing Science authors
Upstream-commit: 09f5e9dae3b83ee9eaa09b8097134d5d4251fce8
Component: engine
2018-08-01 23:50:05 +02:00
97d44663f5 Added additional scientists for balance per names-generator.go policy
Signed-off-by: Russ Magee <rmagee@gmail.com>
Upstream-commit: 72a5e621e574aae8d374559867bf8a5c17d2387b
Component: engine
2018-07-31 11:34:56 -07:00
2d2f5454b7 pkg/system: return nil explicitly
Makes code less confusing.
Otherwise it looks like an error (typo of "==" instead "!=").

Signed-off-by: Iskander Sharipov <quasilyte@gmail.com>
Upstream-commit: cda9d5f7f0c4a155d1ae9e06c203fcb89600ff2a
Component: engine
2018-07-29 01:31:08 +03:00
e5efa80e0f pkg/tarsum: fix unit test for Go 1.11+
Since go-1.11beta1 archive/tar, tar headers with Typeflag == TypeRegA
(numeric 0) (which is the default unless explicitly initialized) are
modified to have Typeflag set to either tar.TypeReg (character value
'0', not numeric 0) or tar.TypeDir (character value '5') [1].
This results in different Typeflag value in the resulting header,
leading to a different Checksum, and causing the following test
case errors:

> 12:09:14 --- FAIL: TestTarSums (0.05s)
> 12:09:14 tarsum_test.go:393: expecting
> [tarsum+sha256:8bf12d7e67c51ee2e8306cba569398b1b9f419969521a12ffb9d8875e8836738],
> but got
> [tarsum+sha256:75258b2c5dcd9adfe24ce71eeca5fc5019c7e669912f15703ede92b1a60cb11f]
> ... (etc.)

All the other code explicitly sets the Typeflag field, but this test
case is not, causing the incompatibility with Go 1.11. Therefore,
the fix is to set TypeReg explicitly, and change the expected checksums
in test cases).

Alternatively, we can vendor archive/tar again (for the 100th time),
but given that the issue is limited to the particular test case it
does not make sense.

This fixes the test for all Go versions.

[1] https://go-review.googlesource.com/c/go/+/85656

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Upstream-commit: 05cbe23db9836476677e7071d21ad53bf93dc2e7
Component: engine
2018-07-19 10:38:45 +03:00
e0dbe6d576 namesgenerator: new adjective and two inspiring Computing Science authors
Signed-off-by: Russ Magee <rmagee@gmail.com>
Upstream-commit: c1ab5c98a223faa7b37cf7dbabf7648bb78155d7
Component: engine
2018-07-15 00:59:27 -07:00
1a06c64c41 Add in two new names for names-generator
Added in : Blase Pascal and Kathleen Antonelli

Signed-off-by: Projjol Banerji <probaner23@gmail.com>
Upstream-commit: ad5d34ad0e6fd14c6aaad3f116a29e24a4f241ec
Component: engine
2018-07-13 00:41:17 +05:30
ca577823d1 Merge pull request #37157 from debayande/even-more-names
Adds a few more names to the name generator.
Upstream-commit: 656036ce2cc949939e7eccc6d87d1e8be26e6890
Component: engine
2018-07-05 21:06:12 +02:00
2a9011606f builder: return image ID in API when using buildkit
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: ca8022ec63a9d0e2f9660e2a3455d821abf8f517
Component: engine
2018-07-03 19:11:02 +00:00
065257683f Adds a few more names to the name generator.
Signed-off-by: Debayan De <debayande@users.noreply.github.com>
Upstream-commit: 9d61eee75a3681fdff7f0c7e3232f4ccd3dfcaf6
Component: engine
2018-07-03 02:12:46 +01:00
b3ce456eca Merge pull request #37356 from Microsoft/jjh/new37316
LCOW: lazycontext: Use correct lstat, fix archive check
Upstream-commit: 1d7132e3d2d91168153db529b8900fb6e53aea92
Component: engine
2018-06-28 12:32:31 +02:00
d2c785277a system: add back lcow validation function
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: f0997716651b6e6c2b07e3d514bf8452114a1433
Component: engine
2018-06-27 15:24:26 -07:00
fbe0a9291a LCOW: lazycontext: Use correct lstat, fix archive check
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: a5aed699cfaa4d84b1b134033fb468b3a7a874f0
Component: engine
2018-06-27 13:29:21 -07:00
23cd5508d9 builder: buildkit rebase update
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 48b93419dcc3dc71584d674f045c30793b890395
Component: engine
2018-06-26 22:59:17 -07:00
0c25b296c2 Initial support for OCI multi-platform image
Add the OCI spec compatible image support in client side.

Signed-off-by: Dennis Chen <dennis.chen@arm.com>
Upstream-commit: 7f334d3acfd7bfde900e16e393662587b9ff74a1
Component: engine
2018-06-26 11:39:29 -07:00
758ffaf745 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
Upstream-commit: 35193c0e7dc301e1d2f6ea96e0ce34ffd2d4b88d
Component: engine
2018-06-26 11:37:43 -07:00
c7d47a1863 Merge pull request #37301 from Mischi/fix-define-self
fix build on OpenBSD by defining Self()
Upstream-commit: cb37987ee11655ed6bbef663d245e55922354c68
Component: engine
2018-06-25 20:25:38 +02:00
6cedb2b4cc Fix a small spacing issue
As a follow up to https://github.com/moby/moby/pull/37331#pullrequestreview-131411625

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 0ed55cd22071a9530feb2ea711cffdfa94e559d8
Component: engine
2018-06-24 17:27:50 +00:00
e4b46b89eb Just satisfying my OCD - fixed comment spacing and removed a hidden character
Signed-off-by: Martin Muzatko <martin@happy-css.com>
Upstream-commit: 7015fc03b72655e9484e68b4ec64b5fca80c68a0
Component: engine
2018-06-22 17:17:08 +02:00
775daf1b72 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>
Upstream-commit: ac5d363e67e01c769b4d9e20ed76a278434ee4de
Component: engine
2018-06-20 11:07:36 -07:00
c62d7149f1 fix build on OpenBSD by defining Self()
Signed-off-by: Fabian Raetz <fabian.raetz@gmail.com>
Upstream-commit: 21537b818de5e4167c5a3856c25b9b06cf16d87d
Component: engine
2018-06-16 19:09:04 +02:00
4cadaa03f8 Update tests to use gotest.tools 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 38457285242e57306c5b7ee652c7ccbb9fbd6713
Component: engine
2018-06-13 09:04:30 +02:00
dc6063672c Close readclosers returned by DecompressStream
Signed-off-by: Joe Ferguson <joe@infosiftr.com>
Upstream-commit: 76e99e1a8b60c831415d2f6a6a7954e16c25620b
Component: engine
2018-06-07 11:16:13 -07:00
0e7017a3ae Merge pull request #36688 from cpuguy83/volumes_service
Extract volume interaction to a volumes service
Upstream-commit: 5037c5a8ce762b46638378b7a7d1081572eadba1
Component: engine
2018-06-05 02:16:20 +02:00
d2c390cca0 Merge pull request #37177 from cpuguy83/minor_plugin_addr_change
Move plugin client to separate interface
Upstream-commit: 71cd53e4a197b303c6ba086bd584ffd67a884281
Component: engine
2018-05-31 08:22:04 -07:00
6aff3ef24e Merge pull request #37174 from thaJeztah/no_additional_magic_matching
Be explicit about github.com prefix being a legacy feature
Upstream-commit: 2ea4ece674e04c04174ee9fff8005cdccdc4fad0
Component: engine
2018-05-31 09:45:59 +02:00
285424548c 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>
Upstream-commit: 7c77df8acc597cd4f540d873de5fe53a3d414ba9
Component: engine
2018-05-30 15:22:10 -04:00
90dfa0b4ee Be explicit about github.com prefix being a legacy feature
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: babb0c14fd1281b309de46c3481a5bea88b8031d
Component: engine
2018-05-30 11:09:14 +02:00