Commit Graph

5439 Commits

Author SHA1 Message Date
d91c638398 Typo fixed and simple code.
Signed-off-by: Ri Xu <xuri@360.net>
Upstream-commit: 87e8a936e82ecfbef59b829d8bbfca3fb4aa3163
Component: engine
2017-10-18 10:26:58 +08:00
9816812d14 Merge pull request #35157 from BSWANG/fix-panic-on-restore
fix panic on get container pid when live restore containers
Upstream-commit: fa2df86ab62a231c8859400540bb4542143f3e0c
Component: engine
2017-10-16 20:24:20 -04:00
77fe26d1a3 daemon: oci: obey CL_UNPRIVILEGED for user namespaced daemon
When runc is bind-mounting a particular path "with options", it has to
do so by first creating a bind-mount and the modifying the options of
said bind-mount via remount. However, in a user namespace, there are
restrictions on which flags you can change with a remount (due to
CL_UNPRIVILEGED being set in this instance). Docker historically has
ignored this, and as a result, internal Docker mounts (such as secrets)
haven't worked with --userns-remap. Fix this by preserving
CL_UNPRIVILEGED mount flags when Docker is spawning containers with user
namespaces enabled.

Ref: https://github.com/opencontainers/runc/pull/1603
Signed-off-by: Aleksa Sarai <asarai@suse.de>
Upstream-commit: c0f883fdeeb2480970fb48fbcbc2a842aa5a90e8
Component: engine
2017-10-16 02:52:56 +11:00
03dc500ba7 Merge pull request #34509 from thaJeztah/fix-network-delete
Fix network name masking network ID on delete
Upstream-commit: 0181eb8f213284b0fae754f28123076c5cab9be4
Component: engine
2017-10-13 08:40:09 -07:00
c90eb48e09 Merge pull request #34960 from sterchelen/34953-Prune-Volume-lack-event-entry
Fix #34953 how volumes are pruned from daemon
Upstream-commit: 2a7388a6c47a58c402acfe0059fbe27a7a090c23
Component: engine
2017-10-12 09:24:26 -07:00
594afcb5ff Merge pull request #35144 from Microsoft/jjh/fixdownlevel
Fix regression on inspect
Upstream-commit: 1ffa10ee2630917e4f2a88f5e4daf34d700eaa1f
Component: engine
2017-10-12 00:52:28 +02:00
33fa7572b6 Fix network name masking network ID on delete
If a network is created with a name that matches another
network's ID, the network with that name was masking the
other network's ID.

As a result, it was not possible to remove the network
with a given ID.

This patch changes the order in which networks are
matched to be what we use for other cases;

1. Match on full ID
2. Match on full Name
3. Match on Partial ID

Before this patch:

    $ docker network create foo
    336717eac9eaa3da6557042a04efc803f7e8862ce6cf96f6b9565265ba5c618b

    $ docker network create 336717eac9eaa3da6557042a04efc803f7e8862ce6cf96f6b9565265ba5c618b
    4a698333f1197f20224583abce14876d7f25fdfe416a8545927006c315915a2a

    $ docker network ls
    NETWORK ID          NAME                                                               DRIVER              SCOPE
    4a698333f119        336717eac9eaa3da6557042a04efc803f7e8862ce6cf96f6b9565265ba5c618b   bridge              local
    d1e40d43a2c0        bridge                                                             bridge              local
    336717eac9ea        foo                                                                bridge              local
    13cf280a1bbf        host                                                               host                local
    d9e4c03728a0        none                                                               null                local

    $ docker network rm 336717eac9eaa3da6557042a04efc803f7e8862ce6cf96f6b9565265ba5c618b
    4a698333f1197f20224583abce14876d7f25fdfe416a8545927006c315915a2a

    $ docker network ls
    NETWORK ID          NAME                DRIVER              SCOPE
    d1e40d43a2c0        bridge              bridge              local
    336717eac9ea        foo                 bridge              local
    13cf280a1bbf        host                host                local
    d9e4c03728a0        none                null                local

After this patch:

    $ docker network create foo
    2d1791a7def4e2a1ef0f6b83c6add333df0bb4ced2f196c584cb64e6bd94b835

    $ docker network create 2d1791a7def4e2a1ef0f6b83c6add333df0bb4ced2f196c584cb64e6bd94b835
    6cbc749a529cd2d9d3b10566c84e56c4203dd88b67417437b5fc7a6e955dd48f

    $ docker network ls
    NETWORK ID          NAME                                                               DRIVER              SCOPE
    6cbc749a529c        2d1791a7def4e2a1ef0f6b83c6add333df0bb4ced2f196c584cb64e6bd94b835   bridge              local
    166c943dbeb5        bridge                                                             bridge              local
    2d1791a7def4        foo                                                                bridge              local
    6c45b8aa6d8e        host                                                               host                local
    b11c96b51ea7        none                                                               null                local

    $ docker network rm 2d1791a7def4e2a1ef0f6b83c6add333df0bb4ced2f196c584cb64e6bd94b835
    2d1791a7def4e2a1ef0f6b83c6add333df0bb4ced2f196c584cb64e6bd94b835

    $ docker network ls
    NETWORK ID          NAME                                                               DRIVER              SCOPE
    6cbc749a529c        2d1791a7def4e2a1ef0f6b83c6add333df0bb4ced2f196c584cb64e6bd94b835   bridge              local
    166c943dbeb5        bridge                                                             bridge              local
    6c45b8aa6d8e        host                                                               host                local
    b11c96b51ea7        none                                                               null                local

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: e52001c56e12e4fc63fb5d89ef919295d6ddd5d5
Component: engine
2017-10-11 21:57:05 +02:00
6bfc0ecd57 Don't abort when setting may_detach_mounts
83c2152de503012195bd26069fd8fbd2dea4b32f sets the kernel param for
fs.may_detach_mounts, but this is not neccessary for the daemon to
operate. Instead of erroring out (and thus aborting startup) just log
the error.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: c6a2044497e0e1ff61350859c8572a2c31c17ced
Component: engine
2017-10-11 14:54:24 -04:00
84fbbffdb4 fix panic on get container pid when live restore containers
Signed-off-by: bingshen.wbs <bingshen.wbs@alibaba-inc.com>
Upstream-commit: db8de0d0da0a5285dfc35d2c81553a1b2d8db24e
Component: engine
2017-10-10 22:45:34 +08:00
1ec5c9a00f Merge pull request #34758 from ghislainbourgeois/33495-add-tcp-to-gelf-log-driver
Add TCP support for GELF log driver
Upstream-commit: 3437f0f4e57453097c42088fcfc2ac6bf7c59170
Component: engine
2017-10-10 10:26:01 -04:00
3730192eec Fix downlevel regression
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: f9b2a20819e7b29ce4dee46d87e8c32ae7ca9899
Component: engine
2017-10-09 13:47:28 -07:00
f174f34034 Fix #34953 how volumes are pruned from daemon
- Call the function that create an event entry while volumes are
pruning.
- Pass volume.Volume type on volumeRm instead of a name. Volume lookup is done
on the exported VolumeRm function.
- Skip volume deletion when force option used and it does not exists.

Signed-off-by: Nicolas Sterchele <sterchele.nicolas@gmail.com>
Upstream-commit: 63864ad8c17f0119a38af3cb9b1bc64a8afd0584
Component: engine
2017-10-09 21:15:26 +02:00
3d973055bf LCOW: API change JSON header to string POST parameter
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: d98ecf2d6cdad7dae65868398440cfdc855e5263
Component: engine
2017-10-06 15:26:48 -07:00
35db73fa01 LCOW: API: Add platform to /images/create and /build
Signed-off-by: John Howard <jhoward@microsoft.com>

This PR has the API changes described in https://github.com/moby/moby/issues/34617.
Specifically, it adds an HTTP header "X-Requested-Platform" which is a JSON-encoded
OCI Image-spec `Platform` structure.

In addition, it renames (almost all) uses of a string variable platform (and associated)
methods/functions to os. This makes it much clearer to disambiguate with the swarm
"platform" which is really os/arch. This is a stepping stone to getting the daemon towards
fully multi-platform/arch-aware, and makes it clear when "operating system" is being
referred to rather than "platform" which is misleadingly used - sometimes in the swarm
meaning, but more often as just the operating system.
Upstream-commit: 0380fbff37922cadf294851b1546f4c212c7f364
Component: engine
2017-10-06 11:44:18 -07:00
9da01454db Fix conflicting container name producint 400 error instead of 409
Commit ebcb7d6b406fe50ea9a237c73004d75884184c33 removed string checking
for error messages, in favor of typed errors.

In this change, the status code for conflicting container  names
changed from 409 to 400 (validationError).

This patch add a `nameConflictError`, changing the status code to
409 as it was in older versions.

With this change applied, the correct 409 status is returned:

```bash
$ docker create --name c1 busybox
```

```bash
$ curl --unix-socket /var/run/docker.sock -v -XPOST -H"Content-Type: application/json" -d'{"Image":"busybox"}' http://localhost/containers/create?name=c1
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying /var/run/docker.sock...
* Connected to localhost (/var/run/docker.sock) port 80 (#0)
> POST /containers/create?name=c1 HTTP/1.1
> Host: localhost
> User-Agent: curl/7.52.1
> Accept: */*
> Content-Type: application/json
> Content-Length: 19
>
* upload completely sent off: 19 out of 19 bytes
< HTTP/1.1 409 Conflict
< Api-Version: 1.33
< Content-Type: application/json
< Docker-Experimental: false
< Ostype: linux
< Server: Docker/17.06.0-dev (linux)
< Date: Thu, 28 Sep 2017 15:07:23 GMT
< Content-Length: 229
<
{"message":"Conflict. The container name \"/c1\" is already in use by container \"ed2efdc806c1883954e677eb9ab8cbc7e286c9c5934ef6724fd5d93c56744923\". You have to remove (or rename) that container to be able to reuse that name."}
* Curl_http_done: called premature == 0
* Connection #0 to host localhost left intact
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: e424343b4348f994d5c2922e7556629a620b4b3b
Component: engine
2017-10-04 20:39:45 +02:00
b11186b8f9 Merge pull request #34342 from coolljt0725/fallback_to_naive_diff
Fallback to use naive diff driver if enable CONFIG_OVERLAY_FS_REDIRECT_DIR
Upstream-commit: 595b929c573236dd95111429039f7f0788c1a7e5
Component: engine
2017-10-03 06:45:17 -07:00
76886c96d8 fix typo
Signed-off-by: Yuhao Fang <fangyuhao@gmail.com>
Upstream-commit: c673319dea5adcb33379b13f8e70c1d157e7c87d
Component: engine
2017-10-01 23:11:58 +08:00
28e35b96d0 Fixing panic when sandbox is nil
Signed-off-by: Pradip Dhara <pradipd@microsoft.com>
Upstream-commit: c4ad0747e929a41ecec7e8c2ae2bd0cc037401ed
Component: engine
2017-09-29 09:23:06 -07:00
00bb761ead Merge pull request #34990 from pradipd/update_field_name
Update field name
Upstream-commit: 853df8f32bf560428fdc39dfd9bfa7bb7c610346
Component: engine
2017-09-27 20:00:18 +02:00
240408899b Merge pull request #34928 from darrenstahlmsft/HnsRunning
Ensure Host Network Service exists
Upstream-commit: 6af60b3c6180817e06ce87d562643b442a866502
Component: engine
2017-09-27 17:35:08 +02:00
4262667057 Merge pull request #34985 from thaJeztah/remove-use-of-deprecated-filter-functions
Remove use of deprecated filter functions
Upstream-commit: a343cba40c25deb2893e13f9a81dbcc4d19d16e2
Component: engine
2017-09-27 17:34:07 +02:00
7ed1303eb4 Merge pull request #34881 from ityangchen/test-moby
"docker swarm init --force-new-cluster" use limit
Upstream-commit: 0b968f91958eea12c2fa82cec64790cb03367232
Component: engine
2017-09-27 14:11:46 +02:00
e4f32567d3 Updating moby to correspond to naming convention used in https://github.com/docker/swarmkit/pull/2385
Signed-off-by: Pradip Dhara <pradipd@microsoft.com>
Upstream-commit: d00a07b1e6d46c3cc9ef95e8b6227115830e2701
Component: engine
2017-09-26 22:08:10 +00:00
de74f6b50c Merge pull request #34952 from allencloud/add-specific-event-filter
add node/service/secret/config specific event filter
Upstream-commit: afe31900915782daf67b40d405d8e7b8e01ab2dd
Component: engine
2017-09-26 22:46:41 +02:00
8a5301f81b Merge pull request #34911 from dnephin/new-ci-entrypoint
Add a new entrypoint for CI
Upstream-commit: a971f9c9d7d1bdc69b197a82c3fb010681f5cd1f
Component: engine
2017-09-26 11:50:44 -07:00
09b100cab2 Merge pull request #34973 from darrenstahlmsft/fixError
Fix error string about containers feature
Upstream-commit: 9feef9287474d0e9afe489d9ad0b71a986a012cb
Component: engine
2017-09-26 18:44:12 +02:00
2a54e5d16e add node/service/secret/config specific event filter
Signed-off-by: Allen Sun <shlallen1990@gmail.com>
Upstream-commit: 4611ecd3cdc9b2738f58a136b79f752add223f3f
Component: engine
2017-09-27 00:23:51 +08:00
5dbfedf3f9 Replace uses of filters.ToParam(), FromParam() with filters.ToJSON(), FromJSON()
`filters.ToParam()` and `filters.FromParam()` were deprecated in favor of
`filters.ToJSON()` and `filters.FromJSON()` in 065118390a3ecaf0dbd2fa752d54d43f8f1e8ec6,
but still used in various locations.

This patch replaces uses of `filters.ToParam()` and  `filters.FromParam()` with
`filters.ToJSON()` and `filters.FromJSON()`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: a4efe66cf2a7648dbcf5b9993bf351925b905b5b
Component: engine
2017-09-26 13:59:45 +02:00
c4c68bf819 Replace uses of filters.Include() with filters.Contains()
The `filters.Include()` method was deprecated in favor of `filters.Contains()`
in 065118390a3ecaf0dbd2fa752d54d43f8f1e8ec6, but still used in various
locations.

This patch replaces uses of `filters.Include()` with `filters.Contains()`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 97c5ae25c4d857563acd1f3467afc760145b1d55
Component: engine
2017-09-26 13:39:56 +02:00
cbf8cc6faf Suppress warning for renaming missing tmp directory
When starting `dockerd` on a host that has no `/var/lib/docker/tmp` directory,
a warning was printed in the logs:

    $ dockerd --data-root=/no-such-directory
    ...
    WARN[2017-09-26T09:37:00.045153377Z] failed to rename /no-such-directory/tmp for background deletion: rename /no-such-directory/tmp /no-such-directory/tmp-old: no such file or directory. Deleting synchronously

Although harmless, the warning does not show any useful information, so can be
skipped.

This patch checks thetype of error, so that warning is not printed.
Other errors will still show up:

    $ touch /i-am-a-file
    $ dockerd --data-root=/i-am-a-file
    Unable to get the full path to root (/i-am-a-file): canonical path points to a file '/i-am-a-file'

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 2b50b14aebc12722f81db8d8f66415e1fa7b954a
Component: engine
2017-09-26 12:04:30 +02:00
401172966f "docker swarm init --force-new-cluster" use limit
Signed-off-by: yangchenliang <yangchenliang@huawei.com>

When worker executor `docker swarm init
--force-new-cluster`,docker would hang.So only manager can process it.

Signed-off-by: yangchenliang <yangchenliang@huawei.com>
Upstream-commit: 12e947efdba5481020f6543514ade83d87c69a28
Component: engine
2017-09-26 12:05:19 +08:00
f367f50630 Move jsonlog to a subpackage of jsonfilelog
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 035604cca6d6bd9a432268caf7515a35023908ed
Component: engine
2017-09-25 16:07:25 -04:00
7d644fb209 Fix benchmarks and remove more unnecessary code.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: a06ad2792ab92d4f246e4b4cc4c3529eb060651e
Component: engine
2017-09-25 16:07:25 -04:00
4701b66889 Remove unused JSONLog marshaling
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 231c5cbd50e1870f31eb6a525b2df2ed7a716565
Component: engine
2017-09-25 16:07:25 -04:00
0c6f170345 Unexport FastTimeMarshalJSON
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 7de92de636ef307d66b7b20b24f166a47f40f72b
Component: engine
2017-09-25 16:07:25 -04:00
101f740d40 Move RFC3339NanoFixed to a more appropriate package.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 27cfa68af16721c978803c3b695bcc7181ccc721
Component: engine
2017-09-25 16:07:24 -04:00
658351133f Fix error string about containers feature
Signed-off-by: Darren Stahl <darst@microsoft.com>
Upstream-commit: 31405b556f155d8f56902086c7c24efe25dd8de0
Component: engine
2017-09-25 12:39:27 -07:00
3c4574bac3 Ensure Host Network Service exists
If HNS does not exist on the Docker host, the daemon may fail with unexpected
and difficult to diagnose errors. This check prevents the daemon from starting
on a system that does not have the correct prerequisites.

Signed-off-by: Darren Stahl <darst@microsoft.com>
Upstream-commit: 1edcc63560cb1286f452565754092bc2eb428ffa
Component: engine
2017-09-25 11:07:44 -07:00
d1d8439f3f Fixes #29654: take reference to RWLayer while committing/exporting
Take an extra reference to rwlayer while the container is being
committed or exported to avoid the removal of that layer.

Also add some checks before commit/export.

Signed-off-by: Yuanhong Peng <pengyuanhong@huawei.com>
Upstream-commit: 8c32659979150630a2c4eae4e7da944806c46297
Component: engine
2017-09-22 09:47:42 +08:00
efc44f60de Fallback to use naive diff driver if enable CONFIG_OVERLAY_FS_REDIRECT_DIR
When use overlay2 as the graphdriver and the kernel enable
`CONFIG_OVERLAY_FS_REDIRECT_DIR=y`, rename a dir in lower layer
will has a xattr to redirct its dir to source dir. This make the
image layer unportable. This patch fallback to use naive diff driver
when kernel enable CONFIG_OVERLAY_FS_REDIRECT_DIR

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: 49c3a7c4bac2877265ef8c4eaf210159560f08b4
Component: engine
2017-09-22 09:40:18 +08:00
3a50fe644a Merge pull request #34861 from tklauser/fix-cstring-leaks
Fix CString memory leaks
Upstream-commit: 777d4a1bf45c85db6931205d4adbe38a17c583d7
Component: engine
2017-09-21 09:14:07 -07:00
0dfdf37ab2 Merge pull request #34914 from euank/000003-percent
overlay2: fix faulty errcheck
Upstream-commit: 48cce229330561c104f777dac4f3f39ef2e2de6e
Component: engine
2017-09-20 19:52:10 -07:00
ccdce91e65 overlay2: fix faulty errcheck
The change in 7a7357dae1bcccb17e9b2d4c7c8f5c025fce56ca inadvertently
changed the `defer` error code into a no-op. This restores its behavior
prior to that code change, and also introduces a little more error
logging.

Signed-off-by: Euan Kemp <euan.kemp@coreos.com>
Upstream-commit: 639ab92f011245e17e9a293455a8dae1eb034022
Component: engine
2017-09-20 15:25:57 -07:00
e55d5634bf Add a new entrypoint for CI
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: dbf580be57a4bb854d7ce20d313e3a22ea337be5
Component: engine
2017-09-20 17:26:30 -04:00
5cb2c664ef Merge pull request #34886 from cpuguy83/may_detach_mount
Automatically set `may_detach_mounts=1` on startup
Upstream-commit: 7d70d0fac339b2ed9715739748c89d0486456407
Component: engine
2017-09-20 11:31:45 -07:00
7e0e805bca Merge pull request #34863 from keloyang/close-pipe
Close pipe in overlay2 graphdriver
Upstream-commit: e40d5e665c6de904ea1e22bb3aa615638ec05e2a
Component: engine
2017-09-20 09:37:15 -07:00
de0f898e39 Automatically set may_detach_mounts=1 on startup
This is kernel config available in RHEL7.4 based kernels that enables
mountpoint removal where the mountpoint exists in other namespaces.
In particular this is important for making this pattern work:

```
umount -l /some/path
rm -r /some/path
```

Where `/some/path` exists in another mount namespace.
Setting this value will prevent `device or resource busy` errors when
attempting to the removal of `/some/path` in the example.

This setting is the default, and non-configurable, on upstream kernels
since 3.15.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 83c2152de503012195bd26069fd8fbd2dea4b32f
Component: engine
2017-09-20 09:57:25 -04:00
d9942eee10 Merge pull request #34117 from cpuguy83/decouple_plugin_manager_from_executor
Decouple plugin manager from libcontainerd package
Upstream-commit: b6b85da6576b3e923325897aab9b12d85c014e1b
Component: engine
2017-09-19 21:07:57 +02:00
6a9321461a Merge pull request #34684 from cpuguy83/fix_selinux_with_mount_api
Set selinux label on local volumes from mounts API
Upstream-commit: 3ddced570dbd7c07291df15bf0b5ac02b04453ca
Component: engine
2017-09-19 13:43:40 -04:00
cb0c1a12c4 Decouple plugin manager from libcontainerd package
libcontainerd has a bunch of platform dependent code and huge interfaces
that are a pain implement.
To make the plugin manager a bit easier to work with, extract the plugin
executor into an interface and move the containerd implementation to a
separate package.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: c85e8622a4813d7b72d74517faa03ab5de4c4550
Component: engine
2017-09-19 12:17:55 -04:00