Commit Graph

1850 Commits

Author SHA1 Message Date
5578aba972 Merge pull request #23193 from allencloud/fix-typos
use grep to find all a/an typos
Upstream-commit: 98c245c9e63793cf8ca03c5500e0820447c1861c
Component: engine
2016-06-02 18:45:08 -07:00
4524589dc5 Add support for user-defined healthchecks
This PR adds support for user-defined health-check probes for Docker
containers. It adds a `HEALTHCHECK` instruction to the Dockerfile syntax plus
some corresponding "docker run" options. It can be used with a restart policy
to automatically restart a container if the check fails.

The `HEALTHCHECK` instruction has two forms:

* `HEALTHCHECK [OPTIONS] CMD command` (check container health by running a command inside the container)
* `HEALTHCHECK NONE` (disable any healthcheck inherited from the base image)

The `HEALTHCHECK` instruction tells Docker how to test a container to check that
it is still working. This can detect cases such as a web server that is stuck in
an infinite loop and unable to handle new connections, even though the server
process is still running.

When a container has a healthcheck specified, it has a _health status_ in
addition to its normal status. This status is initially `starting`. Whenever a
health check passes, it becomes `healthy` (whatever state it was previously in).
After a certain number of consecutive failures, it becomes `unhealthy`.

The options that can appear before `CMD` are:

* `--interval=DURATION` (default: `30s`)
* `--timeout=DURATION` (default: `30s`)
* `--retries=N` (default: `1`)

The health check will first run **interval** seconds after the container is
started, and then again **interval** seconds after each previous check completes.

If a single run of the check takes longer than **timeout** seconds then the check
is considered to have failed.

It takes **retries** consecutive failures of the health check for the container
to be considered `unhealthy`.

There can only be one `HEALTHCHECK` instruction in a Dockerfile. If you list
more than one then only the last `HEALTHCHECK` will take effect.

The command after the `CMD` keyword can be either a shell command (e.g. `HEALTHCHECK
CMD /bin/check-running`) or an _exec_ array (as with other Dockerfile commands;
see e.g. `ENTRYPOINT` for details).

The command's exit status indicates the health status of the container.
The possible values are:

- 0: success - the container is healthy and ready for use
- 1: unhealthy - the container is not working correctly
- 2: starting - the container is not ready for use yet, but is working correctly

If the probe returns 2 ("starting") when the container has already moved out of the
"starting" state then it is treated as "unhealthy" instead.

For example, to check every five minutes or so that a web-server is able to
serve the site's main page within three seconds:

    HEALTHCHECK --interval=5m --timeout=3s \
      CMD curl -f http://localhost/ || exit 1

To help debug failing probes, any output text (UTF-8 encoded) that the command writes
on stdout or stderr will be stored in the health status and can be queried with
`docker inspect`. Such output should be kept short (only the first 4096 bytes
are stored currently).

When the health status of a container changes, a `health_status` event is
generated with the new status. The health status is also displayed in the
`docker ps` output.

Signed-off-by: Thomas Leonard <thomas.leonard@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: b6c7becbfe1d76b1250f6d8e991e645e13808a9c
Component: engine
2016-06-02 23:58:34 +02:00
f9f967f68a Update ContainerStart calls to use options now
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 6b7f12650d8333bf088271acecea5256aef99c41
Component: engine
2016-06-02 16:56:13 +02:00
35c5774373 fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: c1be45fa38e82054dcad606d71446a662524f2d5
Component: engine
2016-06-02 17:17:22 +08:00
e0398fafd2 Merge pull request #22769 from dnephin/integrate_cobra
Use spf13/cobra for the cli
Upstream-commit: 28676fc04b9a307718b66bd28e8d9281d05f38ac
Component: engine
2016-06-01 14:18:23 -07:00
5dcdbc4a5a Remove deprecated -f flag on docker tag
The -f flag on docker tag has been deprecated in docker 1.10 and
is expected to be removed in docker 1.12.

This fix removed the -f flag on docker tag and also updated
deprecated.md.

NOTE: A separate pull request for engine-api has been opened to
cover the related changes.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 4455ec14b87d5ad474c5e11d60907bceb35e9e09
Component: engine
2016-06-01 09:44:25 -07:00
67d0b2dc23 remove deprecated feature of passing HostConfig at API container start
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
Upstream-commit: 0a8386c8be3fa87b7523bef7fd31c81a7f84709c
Component: engine
2016-06-01 22:25:17 +08:00
93473dcef1 Use Args in cobra.Command to validate args.
Also re-use context.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: fc5a4514fbe1b402d2a0bff170486ac3de4bf8cc
Component: engine
2016-05-31 15:43:16 -07:00
041d2192d1 Update usage and help to (almost) match the existing docker behaviour
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 667dcb0e8e550d1a80ee67c6d71979e8cfabea1f
Component: engine
2016-05-31 14:41:37 -07:00
fdda20f059 Migrate volume commands to cobra.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 69264beb4093c56e8c5b256a70e1a0150294c81c
Component: engine
2016-05-31 14:41:37 -07:00
d225e1ee11 Refactor cli inspector to support new inspects.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 6bc3e23f656f111bf72c52ebe67fa9bd7c9ab37b
Component: engine
2016-05-31 14:41:37 -07:00
cdf6273e0c Merge pull request #23091 from allencloud/print-network-name-when-rm
print network name when rm successfully
Upstream-commit: 34e0a01de2e5f070b4d9b7d83166c5cf8fe20300
Component: engine
2016-05-30 13:33:29 +02:00
bb11d0c2a4 print network name when rm successfully
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 27ebd79222759762bec8a582f143408c7a32a969
Component: engine
2016-05-29 23:42:45 +08:00
ea5d7217d0 Merge pull request #22621 from yongtang/05092016-remove-deprecated-command-line-short-variant-options
Un-deprecated command line short variant options of `-c`
Upstream-commit: 4a031f1f80440cc61b56e5b6e111e155e4da066d
Component: engine
2016-05-27 23:12:08 +02:00
d2f37ef500 Merge pull request #22984 from Microsoft/jjh/ttymessage
Better error on attach no tty
Upstream-commit: 24d2ee8c485dc2a580ee57e3afc076dda307e3c8
Component: engine
2016-05-27 16:57:36 +02:00
2e3f90f2fd Un-deprecated command line short variant options of -c.
Since 1.9, the following short variant options have been
deprecated in favor of their long variants:
`docker run -c (--cpu-shares)`
`docker build -c (--cpu-shares)`
`docker create -c (--cpu-shares)`
`docker update -c (--cpu-shares)`

However, `-c` is still widely used and is considered as
a convenient option for swarm (see #16271).

This fix undeprecated the command line short
variant options of `-c` and updated the deprecated.md.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: fea7acf0e9f0532af7451a3c3835a0cfabf4fb20
Component: engine
2016-05-26 08:22:27 -07:00
6e20543be2 Merge pull request #22861 from vdemeester/daemon-images-search-refactoring
Daemon images search refactoring
Upstream-commit: 75109b32db4c23f469b57fb99300fc5d4a689dce
Component: engine
2016-05-26 12:34:31 +02:00
c1a0ccd035 Better error on attach no tty
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: f7541b00b0f68a52195ed9bac967f8f08d96aa51
Component: engine
2016-05-25 13:32:48 -07:00
5773cc71d1 Error login from non TTY
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 541fba13fcbef5e082e3ce08a14901edce4697b6
Component: engine
2016-05-25 09:29:50 -07:00
c25dab543d Add Unit test to daemon.SearchRegistryForImages…
… and refactor a little bit some daemon on the way.

- Move `SearchRegistryForImages` to a new file (`daemon/search.go`) as
  `daemon.go` is getting pretty big.
- `registry.Service` is now an interface (allowing us to decouple it a
  little bit and thus unit test easily).
- Add some unit test for `SearchRegistryForImages`.
- Use UniqueExactMatch for search filters
- And use empty restore id for now in client.ContainerStart.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 636c276f67b3cd96a95dec2f6cfc419b7f219892
Component: engine
2016-05-24 11:07:11 +02:00
c8d36013e6 Rework usage of context.Context in api/client
Make better default usage on context.Context on the `api/client` package
to share the context (it is useless if not shared, which was the case
for a lot of commands).

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 4c7f0d268f413b4a55ea638a97382d9316d082af
Component: engine
2016-05-21 15:57:57 +02:00
214a2bf487 Add a --filter option to docker search
The filtering is made server-side, and the following filters are
supported:

* is-official (boolean)
* is-automated (boolean)
* has-stars (integer)

Signed-off-by: Fabrizio Soppelsa <fsoppelsa@mirantis.com>
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: e009ebdf4c0bf0ff64da8d48eefad63d0644de3e
Component: engine
2016-05-20 13:41:28 +02:00
b96d544c7a Fix bug which mistakes 400 error for 500
Signed-off-by: Wang Xing <hzwangxing@corp.netease.com>
Upstream-commit: beca2615782e24fa28803ada067129fdfa88c77d
Component: engine
2016-05-19 20:01:55 +08:00
e4da61ff20 Merge pull request #22356 from allencloud/close-http-response-body-when-attaching
close http response body when attaching
Upstream-commit: 28452ca78346cf8824ea71be35b4773f96405b1a
Component: engine
2016-05-11 12:44:35 -10:00
86911550d2 Remove deprecated Docker Content Trust ENV passphrase variables
Since 1.9, Docker Content Trust Offline key has been renamed to
Root key and the Tagging key has been renamed to Repository key.
The corresponding environment variables
`DOCKER_CONTENT_TRUST_OFFLINE_PASSPHRASE`
`DOCKER_CONTENT_TRUST_TAGGING_PASSPHRASE`
have also been deprecated and renamed to
`DOCKER_CONTENT_TRUST_ROOT_PASSPHRASE`
`DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE`

This fix removed the deprecated ENV passphrase variables for
1.12 and updated the docs.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 1f0d5aba50803ff401197f96f6a830384d0c04c5
Component: engine
2016-05-07 14:25:28 -07:00
003c321b57 Merge pull request #21889 from cpuguy83/logscmd_add_attrs
Add support for reading logs extra attrs
Upstream-commit: 08ec3606f1656962084222412debf2888f15f553
Component: engine
2016-05-07 20:26:33 +02:00
697f71e4f2 Add support for reading logs extra attrs
The jsonlog logger currently allows specifying envs and labels that
should be propagated to the log message, however there has been no way
to read that back.

This adds a new API option to enable inserting these attrs back to the
log reader.

With timestamps, this looks like so:
```
92016-04-08T15:28:09.835913720Z foo=bar,hello=world hello
```

The extra attrs are comma separated before the log message but after
timestamps.

Without timestaps it looks like so:
```
foo=bar,hello=world hello
```

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: bd9d14a07b9f1c82625dc8483245caf3fa7fe9e6
Component: engine
2016-05-06 20:42:20 -04:00
8d7aa0501d Update trust.go to reflect NotaryRepository API changes:
- Update now returns only an error
 - NewNotaryRepository now takes a trustpinning configuration - we will provide an empty one for now.

Signed-off-by: cyli <cyli@twistedmatrix.com>
Upstream-commit: d869d2b0a07105c80a24755ac6dd12476a085453
Component: engine
2016-05-06 10:59:28 -07:00
10461278b6 close http response body when attaching
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 54d09c6c2d5413f7a05c8a1bc4011298d93979e3
Component: engine
2016-05-06 16:58:22 +08:00
b07f1e75d0 Update engine-api to 1fb8f09960cc32b9648495a422c960fb2a4f8a09
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
Upstream-commit: 97d95604e0f2ac259d60257db0282561e5f52d03
Component: engine
2016-05-05 18:36:09 -04:00
9fb835ad73 Fix #22240 do not pull all the tags implicitely
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 54ebe42de9c359e0c9f171953bd787bb997d719e
Component: engine
2016-05-01 14:46:04 +02:00
9d2d2e1d41 Merge pull request #22372 from dnephin/cli_cleanup
Reorganize client and cli packages
Upstream-commit: 90dfb3dacc56d789b70f5b5f3da6791465706c6c
Component: engine
2016-04-29 17:31:39 -07:00
b5a44200d5 Remove reflection on CLI init
before:
```
$ time docker --help
real  0m0.177s
user  0m0.000s
sys 0m0.040s
```

after:
```
$ time docker --help
real  0m0.010s
user  0m0.000s
sys 0m0.000s
```

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 5c8950e84d2384919f45209f8cc4cbf00ff29015
Component: engine
2016-04-29 11:57:46 -04:00
1f29278b9e Fix bug: exec non-exist command miss a "\n"
When exec a non-exist command, it should print a newline at last.

Currently:
```
$ docker exec -ti f5f703ea2c0a144 bash
rpc error: code = 2 desc = "oci runtime error: exec failed: exec:
\"bash\": executable file not found in $PATH"$
```

Signed-off-by: Feng Yan <fy2462@gmail.com>
Upstream-commit: 8bf5613c1aca634e517e895e90e74f4263cf030f
Component: engine
2016-04-28 16:39:00 +08:00
6f2f3ad4cc Refactor cliconfig so that the default constructor can exist in the package.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 30e3620eaea88cf33fd7deb8c88359469c27b3f7
Component: engine
2016-04-27 14:25:47 -04:00
63df8770d3 Cleanup the structure of the cli package.
Move all flags into cli/flags
Move usage help into cli/usage.go

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 33c9edaf6c5401fc1891713d1ad8d861e6cea51f
Component: engine
2016-04-27 14:25:47 -04:00
860fb4199d make Insecure registries uppercase like other keys in docker info
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: e78884dafd2e9f5378626c4699c6b3b713eecf03
Component: engine
2016-04-25 18:44:34 +08:00
76284509d6 Merge pull request #22138 from wenchma/deprecated_since_before
Deprecated of docker ps since and before options for v1.12
Upstream-commit: 4e5ad97f5b2d9db237546e67de3049649c5ff5e8
Component: engine
2016-04-24 11:23:21 +02:00
b1397d2034 api: server: check for unauthorized error
This functionality has been fixed by
7bca93218291767c5dd8782de0ad630dbcda9995 but then it has been broken
again by a793564b2591035aec5412fbcbcccf220c773a4c and finally refixed
here.

Basically the functionality was to prompt for login when trying to pull
from the official docker hub.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 4316ae2ed33d158e1d8d994646a75e25a70d9320
Component: engine
2016-04-22 17:14:02 +02:00
03d17b8c5f Update code for latest engine-api
- Update CopyToContainer uses
- Use engine-api/types/versions instead of pkg/version

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 7534f17261d0bb74557ca2f7cd893d5b7b531d49
Component: engine
2016-04-19 16:56:54 +02:00
f5ac686743 Deprecated of docker ps since and before options for v1.12
Deprecated note https://github.com/docker/docker/blob/master/docs/deprecated.md#docker-ps-before-and-since-options

Signed-off-by: Wen Cheng Ma <wenchma@cn.ibm.com>
Upstream-commit: 91b715706493059d39c9f8b1d01c9d80ce1799d9
Component: engine
2016-04-19 18:13:55 +08:00
f8a8c81f4e Merge pull request #21657 from vdemeester/update-engine-api
Update engine api with required arguments
Upstream-commit: 7fd53f7c711474791ce4292326e0b1dc7d4d6b0f
Component: engine
2016-04-18 19:47:22 -07:00
145eac88d4 Merge pull request #20835 from cpuguy83/handle_stats_client_errors
Do not remove containers from stats list on err
Upstream-commit: 5314296c693d0d4d7f622940b48bc15e400032e3
Component: engine
2016-04-16 10:20:58 +01:00
8d9f1bcb22 Merge pull request #21939 from calavera/events_until_past
Get events until a time in the past.
Upstream-commit: 19a453e6b40177af31703f107131aae5ca81adf2
Component: engine
2016-04-15 15:33:41 -04:00
b48cb728b8 Update client code with api changes
Using new methods from engine-api, that make it clearer which element is
required when consuming the API.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: b9c94b70bf2f703f260844b3862a61f93dee6337
Component: engine
2016-04-15 12:48:01 +02:00
de95cbad37 Get events until a time in the past.
This change allow to filter events that happened in the past
without waiting for future events. Example:

docker events --since -1h --until -30m

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 55053d3537100eaeaad9c83b43e31f22d14fde7b
Component: engine
2016-04-14 16:22:16 -07:00
90af4a019b Do not remove containers from stats list on err
Before this patch, containers are silently removed from the stats list
on error. This patch instead will display `--` for all fields for the
container that had the error, allowing it to recover from errors.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: ff08036cc0d1b393106570a8c141e909d894f7d3
Component: engine
2016-04-13 16:36:34 -04:00
da8ff9f6e7 Merge pull request #21959 from coolljt0725/fix_21957
Fix docker load progressbar, fixes #21957
Upstream-commit: 348d90276802aac6c76126f2fe6866c521190ecd
Component: engine
2016-04-13 00:31:27 -04:00
94711fe63a Fix docker load progressbar, fixes #21957
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: 96d7db665b06cc0bbede22d818c69dc5f6921f66
Component: engine
2016-04-12 22:45:42 -04:00
e1986078c7 Merge pull request #21897 from calavera/remove_authorization_refs_from_api
Move middleware to interfaces.
Upstream-commit: 9438572fc00f928ec83c884992d5492a7a68babb
Component: engine
2016-04-12 14:08:36 -07:00