Commit Graph

169 Commits

Author SHA1 Message Date
520019f676 Windows: fix build after re-vendoring golang.org/x/sys
Due to the CL https://go-review.googlesource.com/c/39608/ in
x/sys/windows which changed the definitions of STD_INPUT_HANDLE,
STD_OUTPUT_HANDLE and STD_ERROR_HANDLE, we get the following failure
in cmd/dockerd/service_windows.go after re-vendoring x/sys/windows:

  06:29:57 # github.com/docker/docker/cmd/dockerd
  06:29:57 .\service_windows.go:400: cannot use sh (type int) as type uint32 in argument to windows.GetStdHandle

Fix it by adding an explicit type conversion when calling
windows.GetStdHandle.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Upstream-commit: e769da88e6c6e94a397822dd8962cbcb83a402a0
Component: engine
2017-07-12 14:52:42 +02:00
e95f4619cd [project] change syscall to /x/sys/unix|windows
Changes most references of syscall to golang.org/x/sys/
Ones aren't changes include, Errno, Signal and SysProcAttr
as they haven't been implemented in /x/sys/.

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>

[s390x] switch utsname from unsigned to signed

per 33267e036f
char in s390x in the /x/sys/unix package is now signed, so
change the buildtags

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
Upstream-commit: 069fdc8a083cb1663e4f86fe3fd9b9a1aebc3e54
Component: engine
2017-07-11 08:00:32 -04:00
c782cb6c44 Make plugin emit strongly typed, consumable events
Enables other subsystems to watch actions for a plugin(s).

This will be used specifically for implementing plugins on swarm where a
swarm controller needs to watch the state of a plugin.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 72c3bcf2a533a827402945e3a55872e2db4fb024
Component: engine
2017-07-06 14:26:06 -04:00
908bb4d956 Improve routes initialization
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 8f68adfaf0231ded0ba6bd2ec522711752031885
Component: engine
2017-06-22 11:52:43 -07:00
e529bcd027 Implement incremental file sync using client session
Also exposes shared cache and garbage collection/prune
for the source data.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 5c3d2d552b0430672d5f481ab2d37036f6e92166
Component: engine
2017-06-22 11:52:35 -07:00
b1e4d7d884 Add long-running client session endpoint
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: ec7b6238c31e26702ecf366731532e189b5da142
Component: engine
2017-06-22 11:22:41 -07:00
3af9801344 LCOW: Move daemon stores to per platform
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 3aa4a0071536d3b106374eaa44d8a55765901aa6
Component: engine
2017-06-20 19:49:52 -07:00
7ded95d08c LCOW: Deprecate storagedriver option
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 01e597ca4351b83e32346c32ad510f03b0b3b95b
Component: engine
2017-06-20 09:21:37 -07:00
cad0e361c3 LCOW: Add environment variable to enable
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: fe5b34ba8828dc2f2f7db180a102cee360fec6e0
Component: engine
2017-06-20 08:55:46 -07:00
8c7c972d20 Merge pull request #33454 from dnephin/refactor-builder-remove-copy-on-build
[Builder] Move file coping from the daemon to the builder
Upstream-commit: 99c72eb2682c0539ad3cc544eb28876af78b33a1
Component: engine
2017-06-20 10:12:57 +02:00
ead60478b8 add NamedUlimitOpt implement NamedOption to fix 32528
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 148f2711e8e78c9cf43b4c30b03b33b16d9e7098
Component: engine
2017-06-16 10:14:09 +08:00
af2183c2c4 Disable legacy (v1) registries by default
Deprecation of interacting with v1 registries was
started in docker 1.8.3, which added a `--disable-legacy-registry`
flag.

This option was anounced to be the default starting
with docker 17.06, and v1 registries completely
removed in docker 17.12.

This patch updates the default, and disables
interaction with v1 registres by default.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 128280013f2ad90520c97b47a787be0db883e870
Component: engine
2017-06-12 11:04:28 +02:00
13d2adae3f Fix copy when used with scratch and images with empty RootFS
Commit the rwLayer to get the correct DiffID
Refacator copy in thebuilder
move more code into exportImage
cleanup some windows tests
Release the newly commited layer.
Set the imageID on the buildStage after exporting a new image.
Move archiver to BuildManager.
Have ReleaseableLayer.Commit return a layer
and store the Image from exportImage in the local imageSources cache
Remove NewChild from image interface.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 51360965206b0db49cc0365dabb590063a17a9df
Component: engine
2017-06-08 15:07:16 -04:00
91bac6c3f8 Merge pull request #33330 from coolljt0725/fix_sock_is_dir
Don't create source directory while the daemon is being shutdown, fix #30348
Upstream-commit: cd2255a296acf8408d2afb65b897560479f1ecd3
Component: engine
2017-06-07 12:37:08 +09:00
1fd0a9619a Remove cli/flags package
- Moving the `common*.go` files in `cmd/dockerd` directly (it's the
  only place it's getting used)
- Rename `cli/flags` to `cli/config` because it's the only thing left
  in that package 👼

Now, `integration-cli` does *truly* not depend on `cobra` stuff.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 9ff9a91ab7f964f4e5042f94fe22dd50b5c3d832
Component: engine
2017-06-01 13:34:31 -07:00
fe2c9ff86c Don't create source directory while the daemon is being shutdown, fix #30348
If a container mount the socket the daemon is listening on into
container while the daemon is being shutdown, the socket will
not exist on the host, then daemon will assume it's a directory
and create it on the host, this will cause the daemon can't start
next time.

fix issue https://github.com/moby/moby/issues/30348

To reproduce this issue, you can add following code

```
--- a/daemon/oci_linux.go
+++ b/daemon/oci_linux.go
@@ -8,6 +8,7 @@ import (
        "sort"
        "strconv"
        "strings"
+       "time"

        "github.com/Sirupsen/logrus"
        "github.com/docker/docker/container"
@@ -666,7 +667,8 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
        if err := daemon.setupIpcDirs(c); err != nil {
                return nil, err
        }
-
+       fmt.Printf("===please stop the daemon===\n")
+       time.Sleep(time.Second * 2)
        ms, err := daemon.setupMounts(c)
        if err != nil {
                return nil, err

```

step1 run a container which has `--restart always` and `-v /var/run/docker.sock:/sock`
```
$ docker run -ti --restart always -v /var/run/docker.sock:/sock busybox
/ #

```
step2 exit the the container
```
/ # exit
```
and kill the daemon when you see
```
===please stop the daemon===
```
in the daemon log

The daemon can't restart again and fail with `can't create unix socket /var/run/docker.sock: is a directory`.

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: 7318eba5b2f8bb4b867ca943c3229260ca98a3bc
Component: engine
2017-05-30 22:59:51 -04:00
5f22605796 support cluster events
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
Upstream-commit: 59d45c384a2de7bca73296ce1471646db14cb0c8
Component: engine
2017-05-17 11:46:30 -07:00
0e311d1c4e Merge pull request #33151 from nwt/push-foreign-layers
Add daemon option to push foreign layers
Upstream-commit: a30ef99e8dd2c3e7a54b6410a5709f61db59c07f
Component: engine
2017-05-17 02:04:31 +02:00
67b57727bd Add daemon option to push foreign layers
The --allow-nondistributable-artifacts daemon option specifies
registries to which foreign layers should be pushed.  (By default,
foreign layers are not pushed to registries.)

Additionally, to make this option effective, foreign layers are now
pulled from the registry if possible, falling back to the URLs in the
image manifest otherwise.

This option is useful when pushing images containing foreign layers to a
registry on an air-gapped network so hosts on that network can pull the
images without connecting to another server.

Signed-off-by: Noah Treuhaft <noah.treuhaft@docker.com>
Upstream-commit: 67fdf574d5acd6ddccb6ece0ffe0ace1c1608712
Component: engine
2017-05-16 14:36:36 -07:00
deaa6eb130 Use exclusive root pools if a CA cert file is specified in the daemon
Signed-off-by: Ying Li <ying.li@docker.com>
Upstream-commit: ddd5278b07b1c2b12b906244153fd9340e0d7910
Component: engine
2017-05-12 14:43:34 -07:00
8d785cac10 Merge pull request #32587 from dmcgowan/trust-key-config
Expose trust key path in config
Upstream-commit: 577168700200e8e993b2692ef87e05a67783a08c
Component: engine
2017-05-11 21:03:47 +02:00
eaff058a53 Fix race condition between swarm and libnetwork
This commit in conjunction with a libnetwork side commit,
cleans up the libnetwork SetClusterProvider logic interaction.
The previous code was inducing libnetwork to spawn several go
routines that were racing between each other during the agent
init and close.

A test got added to verify that back to back swarm init and leave
are properly processed and not raise crashes

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
Upstream-commit: e2ec006797fa14f59bcf7b9c23505ccdf1d3ded3
Component: engine
2017-05-10 21:16:52 -07:00
6481987490 Expose trust key path in config
Allows storing key under any directory. In the case where the
"/etc/docker" directory is not preserved, this file can be
specified to a location where it will be preserved to ensure
the ID does not change across restarts.

Note this key is currently only used today to generate the ID
used in Docker info and for manifest schema v1 pushes. The key
signature and finger on these manifests are not checked or
used any longer for security, deprecated by notary.

Removes old key migration from a pre-release of Docker which put
the key under the home directory and was used to preserve ID used
for swarm v1 after the file moved.

closes #32135

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Upstream-commit: e428c824c35e85a02fffee592b79ab7db1a0c4d2
Component: engine
2017-05-10 14:16:27 -07:00
9657e321b1 Adding /distribution/{name}/json endpoint to contact registry
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
Upstream-commit: 41b27de41b8b0e034bfe2a3c73b2bc6ff98c7ceb
Component: engine
2017-05-08 16:58:38 -07:00
a8b3ac7249 Remove cmd/docker and other directories in cli/ in accordance with the new Moby project scope
Starting with this commit, integration tests should no longer rely on
the docker cli, they should be API tests instead. For the existing tests
the scripts will use a frozen version of the docker cli with a
DOCKER_API_VERSION frozen to 1.30, which should ensure that the CI remains
green at all times.

To help contributors develop and test manually with a modified docker
cli, this commit also adds a DOCKER_CLI_PATH environment variable to the
Makefile. This allows to set the path of a custom cli that will be
available inside the development container and used to run the
integration tests.

Signed-off-by: Arnaud Porterie (icecrime) <arnaud.porterie@docker.com>
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 32915b1d0a315598edb737785d0357b5a1b8aa11
Component: engine
2017-05-05 12:14:29 -07:00
2bc165a865 Merge pull request #32944 from cpuguy83/add_no_new_privs_flag
Add no-new-privileg flag
Upstream-commit: 140fefd581e6ec3cc1e2d434c2f484d2d386331c
Component: engine
2017-05-04 09:23:01 -04:00
0e66efd28e Add no-new-privileg flag
The daemon config for defaulting to no-new-privileges for containers was
added in d7fda019bb7e24f42f8ae1ddecb3fd52df3c48bf, but somehow we
managed to omit the flag itself, but also documented the flag.
This just adds the actual flag.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: ba332a60b24f40007e7ef234c0f44ae5a5ff9d49
Component: engine
2017-05-01 15:31:56 -04:00
3d193f829d Extract squash and tagging from the Dockerfile builder.
Remove pathCache and replace it with syncmap
Cleanup NewBuilder
Create an api/server/backend/build
Extract BuildTagger

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 0296797f0f39477d675128c93c1646b3186937ee
Component: engine
2017-05-01 12:07:32 -04:00
142883d5b3 Remove pkg/testutil/assert in favor of testify
I noticed that we're using a homegrown package for assertions. The
functions are extremely similar to testify, but with enough slight
differences to be confusing (for example, Equal takes its arguments in a
different order). We already vendor testify, and it's used in a few
places by tests.

I also found some problems with pkg/testutil/assert. For example, the
NotNil function seems to be broken. It checks the argument against
"nil", which only works for an interface. If you pass in a nil map or
slice, the equality check will fail.

In the interest of avoiding NIH, I'm proposing replacing
pkg/testutil/assert with testify. The test code looks almost the same,
but we avoid the confusion of having two similar but slightly different
assertion packages, and having to maintain our own package instead of
using a commonly-used one.

In the process, I found a few places where the tests should halt if an
assertion fails, so I've made those cases (that I noticed) use "require"
instead of "assert", and I've vendored the "require" package from
testify alongside the already-present "assert" package.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 6052f2b3969feadb01662d8e2f30337d9c7f61af
Component: engine
2017-04-14 12:03:21 -07:00
5d994cf1a3 Merge pull request #32244 from Microsoft/jjh/panicfix
Windows - fix panic and stderr output when service
Upstream-commit: a96de091d644db1c31b699a7a22d9ef63b376560
Component: engine
2017-04-01 20:00:59 +02:00
75453ad8e7 Windows - fix panic and stderr
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 141a83b820140fac130840b2a0ea9df75ab4e55d
Component: engine
2017-03-31 09:51:50 -07:00
f66bd50c2b Merge pull request #28696 from jlhawn/deprecate_graph_flag
Deprecate --graph flag; Replace with --data-root
Upstream-commit: 1ecaed0a99331ff6140e0a714e1b50d466597775
Component: engine
2017-03-31 10:51:15 +02:00
890e256320 Merge pull request #32174 from KarthikNayak/32113
Dockerd: enable CORS when only `--api-cors-header` is used
Upstream-commit: 59aed5ab36b1b5b360aa230effbefd757e889329
Component: engine
2017-03-30 11:13:52 -04:00
719f2c6960 Add conflict check for flags, and update deprecation versions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: df7a72cffa7f28c67fb25eecd113dc21822afcc0
Component: engine
2017-03-30 12:21:05 +02:00
dcff175aff Remove constant for "config-file" flag
None of the daemon flags use a constant for the
flag name.

This patch removes the constant for consistency

Also removes a FIXME, that was now in the wrong
location, and added a long time ago in
353b7c8ec77b30fa83dac5ec0778193f6de8b437,
without a lot of context (and probably no longer really relevant).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 9894576fb7e11d9536e09ca04193b845a33b9dec
Component: engine
2017-03-30 12:01:00 +02:00
fd940e1e8e Deprecate --graph flag; Replace with --data-root
Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 261ef1fa27c4dfefa5f686b0a4ef354a43040e58
Component: engine
2017-03-30 11:24:56 +02:00
487d9cf34a Merge pull request #31830 from dnephin/refactor-cli-state
Small cleanup now that we have multiple details about the server stored on the cli
Upstream-commit: bce494f7a2ce0e1a2c6563b2e32e5a8bacb128ba
Component: engine
2017-03-29 13:36:32 +02:00
2b108da4a1 Dockerd: enable CORS when only --api-cors-header is used
Even though the flag `--api-enable-cors` is deprecated in favor of
`--api-cors-header`. Using only `--api-cors-header` does not enable
CORS.

Make changes to 'cmd/dockerd/daemon.go' to enable cors if either of
the above flags is set.

Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
Upstream-commit: f0f673f4d50ac072e4c7a236d2a318632c4fa89c
Component: engine
2017-03-28 18:09:14 +05:30
1faeba234d Merge pull request #31668 from Microsoft/jjh/nopidfileasservice
Windows: no pidfile when service
Upstream-commit: b47c50cf11a48c068e8794af1cd2bfebdae90995
Component: engine
2017-03-23 17:10:35 -04:00
30a11974ed Merge pull request #31930 from anusha-ragunathan/authz-disable
When authz plugin is disabled, remove from authz middleware chain.
Upstream-commit: bbce24997c7a31454edd1d3d979823582bcdd95d
Component: engine
2017-03-22 14:17:38 -07:00
2034662b7a When authz plugin is disabled, remove from authz middleware chain.
When the daemon is configured to run with an authorization-plugin and if
the plugin is disabled, the daemon continues to send API requests to the
plugin and expect it to respond. But the plugin has been disabled. As a
result, all API requests are blocked. Fix this behavior by removing the
disabled plugin from the authz middleware chain.

Tested using riyaz/authz-no-volume-plugin and observed that after
disabling the plugin, API request/response is functional.

Fixes #31836

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
Upstream-commit: 38de272bd4dfea945985b7031cd353ac5f6507c5
Component: engine
2017-03-22 12:07:39 -07:00
7bf0179b13 update "docker daemon" deprecation message for new version scheme
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: ba76a0c91212d47ae797848802595eef92fa07fa
Component: engine
2017-03-22 00:21:15 +01:00
5ed1f03370 Create a new ServerType struct for storing details about the server on the client.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 41522439859b5d62651e71a424c03f96be26aec3
Component: engine
2017-03-20 12:48:25 -04:00
8021eb2bf2 Improve error handling of commands run against unsupported daemon
The current error-handling only checked for version annotations
on the subcommand itself, but did not check the top-level command.

This patch always traverses the command path (parents), and
prints an error if the command is not supported.

Before this change:

    $ docker service
    Usage:	docker service COMMAND

    Manage services

    Options:
          --help   Print usage

    Commands:
      create      Create a new service
      inspect     Display detailed information on one or more services
      ls          List services
      ps          List the tasks of one or more services
      rm          Remove one or more services
      scale       Scale one or multiple replicated services
      update      Update a service

    Run 'docker service COMMAND --help' for more information on a command.

    $ docker service ls
    ID                  NAME                MODE                REPLICAS            IMAGE

After this change:

    $ DOCKER_API_VERSION=1.12 docker service
    docker service requires API version 1.24, but the Docker daemon API version is 1.12

    $ DOCKER_API_VERSION=1.12 docker service ls
    docker service ls requires API version 1.24, but the Docker daemon API version is 1.12

    $ DOCKER_API_VERSION=1.24 docker plugin --help
    docker plugin requires API version 1.25, but the Docker daemon API version is 1.24

    $ DOCKER_API_VERSION=1.25 docker plugin upgrade --help
    docker plugin upgrade requires API version 1.26, but the Docker daemon API version is 1.25

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 15d63f1c5ba40a0937a935c866c384c953c79b16
Component: engine
2017-03-16 13:45:50 +01:00
da38e7fbf1 Hide command options that are related to Windows
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Upstream-commit: 7199522ea2e77c77bf931474eca92aa502ce0031
Component: engine
2017-03-12 08:47:17 +02:00
5f9634b1f6 Windows: no pidfile when service
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: a8e144dab4ec12eb5111df26abc87f7939faa1c3
Component: engine
2017-03-08 15:18:30 -08:00
b34943b2d7 cmd: docker: fix TestDaemonCommand
In more recent versions of Cobra, `--help` parsing is done before
anything else resulting in TestDaemonCommand not actually passing. I'm
actually unsure if this test ever passed since it appears that !daemon
is not being run as part of the test suite.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
Upstream-commit: dd7159060f60ea04007c069df189a29fda2c655f
Component: engine
2017-03-05 15:26:49 +11:00
31865190c5 'docker daemon' deprecation message doesn't use the new versioning scheme
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
Upstream-commit: 5a9cee7bb57e7da7f2793fbb290498bba0531105
Component: engine
2017-03-03 17:26:49 +08:00
19d262d100 Merge pull request #31054 from darrenstahlmsft/WaitOOBE
Windows: Wait for OOBE to prevent crashing during host update
Upstream-commit: 7f0b833621f61072d3176d224be02ea5089761f9
Component: engine
2017-02-16 11:18:25 -05:00
d0f9d01ec6 Windows: Wait for OOBE to prevent crashing during host update
Signed-off-by: Darren Stahl <darst@microsoft.com>
Upstream-commit: e128a65685dafd640e32118eb1903581489f7e31
Component: engine
2017-02-15 14:01:54 -08:00