Commit Graph

2382 Commits

Author SHA1 Message Date
451b8c0ac8 Merge pull request #33502 from crosbymichael/bsd-opost
Set OPOST on bsd
Upstream-commit: df423d57936bf6e94bb1e54892f5419e1d927708
Component: engine
2017-06-03 02:30:58 +02:00
b8e386fca4 Move pkg/gitutils to remotecontext/git
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: b9d85ac58db8b8d4480fca93f8b952d084ea36f5
Component: engine
2017-06-02 16:54:50 -04:00
b9c4f53912 Remove the last of pkg/httputil
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 4060d6ee0b130cf74294c309dfbd3c860fd2a7f8
Component: engine
2017-06-02 16:54:36 -04:00
16c0836e84 Move an error helper to registry/session.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: a6ac5495e11d34b1887476ca89f841df1056249a
Component: engine
2017-06-02 16:10:40 -04:00
7636bfd2c7 Move httputils/reasumablerequestreader to the single consumer.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 65515af075ce5f8037750c253b2834008840afc1
Component: engine
2017-06-02 16:10:39 -04:00
04eec7106a Move httputils/mimtype to the single consumser, and remove unused function.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: c91521be68182b450a22f018ccc9d780571a5936
Component: engine
2017-06-02 16:10:39 -04:00
899cb8ee5f Set OPOST on bsd
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 17ec46a24316f59c808c112e3ca46d7c442a785a
Component: engine
2017-06-02 12:53:49 -07:00
013b9a64df Merge pull request #33485 from tpot/33484-fix-file-perm-octal
Use octal values for file mode in filenotify poller and sysinfo_linux tests
Upstream-commit: 91e0141784ab5570fd7f94ad4af399d23c827391
Component: engine
2017-06-02 11:15:42 -04:00
97873b880b Merge pull request #33479 from vieux/move_multireader
move multireader out of /pkg
Upstream-commit: 096eeb3e75e9c76ec30f35356b2a4e46b0b51ed2
Component: engine
2017-06-02 12:04:57 +02:00
f9502cbcaf Use octal values for file mode in filenotify poller and sysinfo_linux tests
Closes #33484.

Signed-off-by: Tim Potter <tpot@hpe.com>
Upstream-commit: c35ea6b2cda8ac68f2b4a9f6471ca7e09865a6ee
Component: engine
2017-06-02 12:27:10 +10:00
b6073e5ee6 Fix incorrect assert message in TestReadProcBool
Closes #33480.

Signed-off-by: Tim Potter <tpot@hpe.com>
Upstream-commit: cd457e7885ecb0b00e91162113ce597f131c8386
Component: engine
2017-06-02 10:15:58 +10:00
a1a5b0a48d move multireader out of /pkg
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Upstream-commit: 2445e6b99d4beecb25d556d9a099bdf47703e174
Component: engine
2017-06-01 16:22:00 -07:00
421a16553e Increase the Coverage of pkg/platform
Signed-off-by: Raja Sami <raja.sami@tenpearls.com>
Upstream-commit: bdc87676bfee0f9a26fe12323dbe6875af783645
Component: engine
2017-05-31 13:26:40 +05:00
81bb7bdddf Do not reuse a http.Request after a failure in callWithRetry
Closes: #33412

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
Upstream-commit: 62871ef2fa52b0a2e426c30f36d35a9ba1e92fac
Component: engine
2017-05-26 18:02:31 -07:00
75a4055d7c Ensure that a device mapper task is referenced until task is complete
DeviceMapper tasks in go use SetFinalizer to clean up C construct
counterparts in the C LVM library.  While thats well and good, it relies
heavily on the exact interpretation of when the golang garbage collector
determines that an object is unreachable is subject to reclaimation.
While common sense would assert that for stack variables (which these DM
tasks always are), are unreachable when the stack frame in which they
are declared returns, thats not the case.  According to this:

https://golang.org/pkg/runtime/#SetFinalizer

The garbage collector decides that, if a function calls into a
systemcall (which task.run() always will in LVM), and there are no
subsequent references to the task variable within that stack frame, then
it can be reclaimed.  Those conditions are met in several devmapper.go
routines, and if the garbage collector runs in the middle of a
deviceMapper operation, then the task can be destroyed while the
operation is in progress, leading to crashes, failed operations and
other unpredictable behavior.

The fix is to use the KeepAlive interface:

https://golang.org/pkg/runtime/#KeepAlive

The KeepAlive method is effectively an empy reference that fools the
garbage collector into thinking that a variable is still reachable.  By
adding a call to KeepAlive in the task.run() method, we can ensure that
the garbage collector won't reclaim a task object until its execution
within the deviceMapper C library is complete.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Upstream-commit: d764d8b16624e4924b3949273089f851efa0f717
Component: engine
2017-05-24 11:11:23 -04:00
a41009bb07 Merge pull request #33269 from tophj-ibm/switch-more-syscalls-pkg-term
[pkg/term] switch more syscalls to /x/sys/
Upstream-commit: dd27bbb41a7f98a0beea3d7f39da0dbb53e29ff5
Component: engine
2017-05-19 02:37:52 +02:00
6b7f9e397d Merge pull request #33250 from cyphar/apparmor-readonly-root-fix
apparmor: make pkg/aaparser work on read-only root
Upstream-commit: 6b262572028cc249b7da8cc55459197395fdb33e
Component: engine
2017-05-18 23:17:31 +02:00
f074fcfdd0 [pkg/term] switch more syscalls to /x/sys/
Switches the remaining syscalls except Errno to /x/sys/.
This was supposed to be part of 33180

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
Upstream-commit: df6dfcf198a769e7f411736e1abb93e1aabb2698
Component: engine
2017-05-18 09:02:42 -04:00
934384aeb2 Merge pull request #33180 from tophj-ibm/switch-pkg-term-syscalls-to-x/sys
[pkg/term] refactor and switch syscall to x/sys
Upstream-commit: 6f6ee6fd04b9a1ac91f24631cdea9453e9fd35f7
Component: engine
2017-05-17 07:41:18 -07:00
e7e4e93352 apparmor: make pkg/aaparser work on read-only root
This is necessary because normally `apparmor_parser -r` will try to
create a temporary directory on the host (which is not allowed if the
host has a rootfs). However, the -K option bypasses saving things to the
cache (which avoids this issue).

  % apparmor_parser -r /tmp/docker-profile
  mkstemp: Read-only file system
  % apparmor_parser -Kr /tmp/docker-profile
  %

In addition, add extra information to the ensureDefaultAppArmorProfile
errors so that problems like this are easier to debug.

Fixes: 2f7596aaef3a ("apparmor: do not save profile to /etc/apparmor.d")
Signed-off-by: Aleksa Sarai <asarai@suse.de>
Upstream-commit: dd340c52cb37d29d8bae687fdc60e039341b4295
Component: engine
2017-05-18 00:05:13 +10:00
fa44d02011 Update ContainerWait API
This patch adds the untilRemoved option to the ContainerWait API which
allows the client to wait until the container is not only exited but
also removed.

This patch also adds some more CLI integration tests for waiting for a
created container and waiting with the new --until-removed flag.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Handle detach sequence in CLI

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Update Container Wait Conditions

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Apply container wait changes to API 1.30

The set of changes to the containerWait API missed the cut for the
Docker 17.05 release (API version 1.29). This patch bumps the version
checks to use 1.30 instead.

This patch also makes a minor update to a testfile which was added to
the builder/dockerfile package.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Remove wait changes from CLI

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Address minor nits on wait changes

- Changed the name of the tty Proxy wrapper to `escapeProxy`
- Removed the unnecessary Error() method on container.State
- Fixes a typo in comment (repeated word)

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Use router.WithCancel in the containerWait handler

This handler previously added this functionality manually but now uses
the existing wrapper which does it for us.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Add WaitCondition constants to api/types/container

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Address more ContainerWait review comments

- Update ContainerWait backend interface to not return pointer values
  for container.StateStatus type.
- Updated container state's Wait() method comments to clarify that a
  context MUST be used for cancelling the request, setting timeouts,
  and to avoid goroutine leaks.
- Removed unnecessary buffering when making channels in the client's
  ContainerWait methods.
- Renamed result and error channels in client's ContainerWait methods
  to clarify that only a single result or error value would be sent
  on the channel.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Move container.WaitCondition type to separate file

... to avoid conflict with swagger-generated code for API response

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Address more ContainerWait review comments

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 4921171587c09d0fcd8086a62a25813332f44112
Component: engine
2017-05-16 15:11:39 -07:00
9ca246ac83 Merge pull request #32959 from simonferquel/tar-filemode-windows
Respect tar entries modes when rewriting them on Windows
Upstream-commit: ad846a136a75637c64423d7f9eb0f2f5e433a360
Component: engine
2017-05-16 11:45:42 -07:00
474b9fb5b6 Rename term to winsize, tc_other to tc
Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
Upstream-commit: 1c94c264c489e1d5fdae7f41120574e0322ab31d
Component: engine
2017-05-16 11:46:17 -04:00
b0891a48c7 [pkg/term] Refactor BSD-specific files
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: f8416e82d9152c7f833b9ea6ccb29cb221e14c16
Component: engine
2017-05-16 10:12:33 -04:00
b94eb3ae57 [pkg/term] switch syscall to x/sys
Switches calls to syscall to x/sys, which is more up to date.
This is fixes a number of possible bugs on other architectures
where ioctl tcget and tcset aren't implemented correctly.

There are a few remaining syscall references, because x/sys doesn't
have an Errno implementation yet.

Also removes a ppc64le and cgo build tag that fixes building on
ppc64le without cgo

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
Upstream-commit: f30b072b8157599cdd996b86d022117d2d55d1ce
Component: engine
2017-05-15 18:34:41 -04:00
8a368b7357 Merge pull request #33119 from nhorman/devmapper-fixes
Devmapper fixes for cookie generation and error reporting (fixes  #33050)
Upstream-commit: 2c45392b8fe134ef9689488d7e9e00ef711f9ee4
Component: engine
2017-05-15 13:18:52 -04:00
04ea6ad3f6 Merge pull request #32502 from tonistiigi/git-allow-pr-number
Allow specifying any remote ref in git checkout URLs
Upstream-commit: ba52bb0fd158dcd99ff65d0a422add8ecde01b3e
Component: engine
2017-05-15 09:34:54 -07:00
59422fa37f Update the stream formatter to display custom unit numbers.
Signed-off-by: Ying Li <ying.li@docker.com>
Upstream-commit: a771c16834c92cb39142078c64e253423f0fb4e3
Component: engine
2017-05-11 11:13:11 -07:00
dc91a6dbf3 Merge pull request #33139 from stevvooe/remove-unused-functions
pkg/ioutils: remove unused functions
Upstream-commit: e8c2a33b747ac1f69d3992a47844abf1d7f58910
Component: engine
2017-05-10 16:48:14 -04:00
4f4a20dea3 Merge pull request #33128 from crosbymichael/update-containerd-2x
Update containerd for terminal updates
Upstream-commit: a46f7bd5bd5d1a0d5593034fc540193ef7ed3644
Component: engine
2017-05-10 16:45:11 -04:00
9e5ba6cea7 pkg/ioutils: remove unused functions
Signed-off-by: Stephen J Day <stephen.day@docker.com>
Upstream-commit: c546894aefbd661adc73ba3cf952d38f94627924
Component: engine
2017-05-10 08:34:16 -07:00
4d8c6f2827 Merge pull request #31012 from cpuguy83/do_not_remove_containers_on_error
Do not remove containers from memory on error
Upstream-commit: 815e8bb885c3d9f70ab763d9844e857590b40ad3
Component: engine
2017-05-10 06:21:28 -04:00
8a31debf44 Add OPOST back to !cgo build for pkg/term
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 270a33b666ff9a1b3925c5cf53c336b6fab20dc3
Component: engine
2017-05-09 16:36:17 -07:00
88c1779859 Merge pull request #32145 from ripcurld0/fix_32120
Disable HTML escaping for JSON in formatter
Upstream-commit: 3d7af24f63281570edf7f6b254cfd568e5e19aec
Component: engine
2017-05-10 06:54:56 +09:00
8aa5280c2b Move UdevWait from defer to inline
All LVM actions in the devicemapper library are asyncronous, involving a call to
a task enqueue function (dm_run_task) and a wait on a resultant udev event
(UdevWait).  Currently devmapper.go defers all calls to UdevWait, which discards
the return value.  While it still generates an error message in the log (if
debugging is enabled), the calling thread is still allowed to continue as if no
error has occured, leading to subsequent errors, and significant confusion when
debugging, due to those subsequent errors.  Given that there is no risk of panic
between the task submission and the wait operation, it seems more reasonable to
preform the UdevWait inline at the end of any given lvm action so that errors
can be caught and returned before docker can continue and create additional
failures.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Upstream-commit: 5206d45e70512f5fc06006047fb67b2f478b304d
Component: engine
2017-05-09 13:42:04 -04:00
eba04294b8 Make cookies for devicemapper operations unique
Currently, the devicemapper library sets cookies to correlate wait operations,
which must be unique (as the lvm2 library doesn't detect duplicate cookies).
The current method for cookie generation is to take the address of a cookie
variable.  However, because the variable is declared on the stack, execution
patterns can lead to the cookie variable being declared at the same stack
location, which results in a high likelyhood of duplicate cookie use, which in
turn can lead to various odd lvm behaviors, which can be hard to track down
(object use before create, duplicate completions, etc).  Lets guarantee that the
cookie we generate is unique by declaring it on the heap instead.  This
guarantees that the address of the variable won't be reused until such time as
the UdevWait operation completes, and drops its reference to it, at which time
the gc can reclaim it.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Upstream-commit: edd1c9e3255ddd80c97313bd596812dbb3470a5b
Component: engine
2017-05-09 13:42:01 -04:00
eb8c8e2f7c Enhance error logging for failed UdevWait operations in devmapper
If a wait event fails when preforming a devicemapper operation, it would be good
to know, in addition to the cookie that its waiting on, we reported the error
that was reported from the lvm2 library.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Upstream-commit: 547510fb554bb77aa7f09efd46361306152b9d55
Component: engine
2017-05-09 13:41:12 -04:00
07ecdb31c7 Disable HTML escaping for JSON in formatter
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Upstream-commit: 5766317e33f088c438eff52124c516f18e764b99
Component: engine
2017-05-09 10:16:10 +03:00
53d1a4eb83 Merge pull request #33007 from crosbymichael/containerd-rc5
Update moby to containerd and runc 1.0 final rc
Upstream-commit: 7238cca42c3d024adfa030306ad3e3ec4232baed
Component: engine
2017-05-08 09:23:07 -07:00
d267fa757f Do not remove containers from memory on error
Before this, if `forceRemove` is set the container data will be removed
no matter what, including if there are issues with removing container
on-disk state (rw layer, container root).

In practice this causes a lot of issues with leaked data sitting on
disk that users are not able to clean up themselves.
This is particularly a problem while the `EBUSY` errors on remove are so
prevalent. So for now let's not keep this behavior.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 54dcbab25ea4771da303fa95e0c26f2d39487b49
Component: engine
2017-05-05 17:02:04 -04:00
ce61a3d4f2 Update moby to runc and oci 1.0 runtime final rc
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 005506d36c1c9308a05592d7596f3d484359c426
Component: engine
2017-05-05 13:45:45 -07:00
400bf9fc6d Prevent ppc64le to build pkg/term without cgo
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 71e9f5c520bd457508994b11938b7a6c577beaaf
Component: engine
2017-05-05 12:14:30 -07:00
bd17f42bef Add docker build --iidfile=FILE
This is synonymous with `docker run --cidfile=FILE` and writes the digest of
the newly built image to the named file. This is intended to be used by build
systems which want to avoid tagging (perhaps because they are in CI or
otherwise want to avoid fixed names which can clash) by enabling e.g. Makefile
constructs like:

    image.id: Dockerfile
    	docker build --iidfile=image.id .

    do-some-more-stuff: image.id
    	do-stuff-with <image.id

Currently the only way to achieve this is to use `docker build -q` and capture
the stdout, but at the expense of losing the build output.

In non-silent mode (without `-q`) with API >= v1.29 the caller will now see a
`JSONMessage` with the `Aux` field containing a `types.BuildResult` in the
output stream for each image/layer produced during the build, with the final
one being the end product.  Having all of the intermediate images might be
interesting in some cases.

In silent mode (with `-q`) there is no change, on success the only output will
be the resulting image digest as it was previosuly.

There was no wrapper to just output an Aux section without enclosing it in a
Progress, so add one here.

Added some tests to integration cli tests.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
Upstream-commit: 5894bc1abf8186802d360d20739b57bfffed51df
Component: engine
2017-05-05 16:35:54 +01:00
b61f5e2e48 Allow checking out any ref in gitutils
Also changes so that shallow fetch is performed
even when a specific ref is specified.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 493a6c3d41bbe4f5741c27cf8af2e88af65485d2
Component: engine
2017-05-04 14:14:50 -07:00
755f9321e1 Refacator pkg/streamformatter
StreamFormatter suffered was two distinct structs mixed into a single struct
without any overlap.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: c87d67b0ad788a6a80d1af89488e2d1f22726c34
Component: engine
2017-05-02 17:38:12 -04:00
0802cc654a Respect tar entries modes when rewriting them on Windows
Previously, only perm-related bits where preserved when rewriting
FileMode in tar entries on Windows. This had the nasty side effect of
having tarsum returning different values when executing from a tar filed
produced on Windows or Linux.

This fix the issue, and pave the way for incremental build context
to work in hybrid contexts.

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
Upstream-commit: 41eb61d5c2a44c745b11ada948034fd3bcc42db5
Component: engine
2017-05-02 11:36:43 +02:00
4554383dcd Merge pull request #31391 from cpuguy83/fix_volume_unmount_disconnected_fs
Use lazy unmount for local volume driver unmount
Upstream-commit: ccc1324b59e5768a3ef0236f112e1af20f7fbd2f
Component: engine
2017-04-27 16:22:58 -04:00
e369d2c215 Don't error with empty group
Don't error if no group is specified, as this was the prior API.  Also
don't return a docker specific error message as this is in `/pkg` and
used by other projects.  Just set the default group for the current
user/group consuming the package.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 169c013911c9465f0e62a37f467d1afa54a0dbe7
Component: engine
2017-04-27 09:26:21 -07:00
2805ccbd34 Use lazy unmount for local volume driver unmount
This fixes issues where the underlying filesystem may be disconnected and
attempting to unmount may cause a hang.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: acbfe6bc56b9357d40a452f6b3901cb2c2d40404
Component: engine
2017-04-27 08:43:43 -04:00
60d521eac2 Merge pull request #32768 from dnephin/try-enable-test-matches-on-windows
Enable TestMatches on windows
Upstream-commit: c264aefdac2d0698df62d203455fcee83e9fd7ee
Component: engine
2017-04-23 15:54:45 +02:00