Commit Graph

78 Commits

Author SHA1 Message Date
69096baccb Merge pull request #23532 from swernli/exitCodeFix
Fixing exit code return on error case in Windows.
Upstream-commit: a590a6b1800778c86f6649b64283d29d14d83024
Component: engine
2016-06-16 19:01:18 -07:00
b47fcaaeab Fixing exit code return on error case in Windows.
Right now, if we hit an error retrieving the exit code in HCS process.ExitCode, we return that 0 and that error.  Golang convention says that if an error is returned the other values should not be used, but the caller of ExitCode in libcontainerd has to fall through if an error is received.  Rather than return a success exit code in that failure case, we should return -1 to indicate a generic failure.

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
Upstream-commit: 17c1b9c061139a2655252f6fb5e36f616a8c5f5e
Component: engine
2016-06-14 10:19:55 -07:00
811cef6ca3 Add support for multiples runtimes
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: 7b2e5216b89b4c454d67473f1fa06c52a4624680
Component: engine
2016-06-14 07:47:31 -07:00
9ada0cfc5f Merge pull request #23213 from crosbymichael/restore-option
Add --live-restore flag
Upstream-commit: 3020081e94277410984c62d12f88de3d4f258681
Component: engine
2016-06-13 20:57:19 -07:00
7af900395b Add --live-restore flag
This flags enables full support of daemonless containers in docker.  It
ensures that docker does not stop containers on shutdown or restore and
properly reconnects to the container when restarted.

This is not the default because of backwards compat but should be the
desired outcome for people running containers in prod.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: d705dab1b1bd0a946d647374325d61fac57736db
Component: engine
2016-06-13 19:16:26 -07:00
0a17038359 Merge pull request #23443 from swernli/servicing-async
Updating call sequence for servicing Windows containers
Upstream-commit: 50c7bcac1e22a6a3dd39bec4136aa96136f56eb2
Component: engine
2016-06-13 19:49:23 +02:00
763e6c326e *: fix logrus.Warn[f]
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 44ccbb317c2ca67fd8a88147b1ff80ce83d453cc
Component: engine
2016-06-11 19:42:38 +02:00
28d7534bc7 Updating call sequence for servicing Windows containers
This change adjusts the calling pattern for servcing containers to use waiting on the process instead of expecting start to block.  This is safer, as it avoids timeouts in the start code path for the potentially expensive update operation.

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
Upstream-commit: f2ad7be2c4aa13413d539887e8c13fb47bea7254
Component: engine
2016-06-10 15:19:10 -07:00
743a9e8b07 Increase containerd start-timeout to 2 minutes
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
(cherry picked from commit 4251e1e99e16ff7ff5557ee16e5bef26a14cd127)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 64a91ee74e73c956e92801447ae73ba82d168ed5
Component: engine
2016-06-10 16:22:19 +02:00
79ea898035 Fix some typos
Signed-off-by: Jannick Fahlbusch <git@jf-projects.de>
Upstream-commit: e3490cdcc0e2b1e4c4da125626430016a3048128
Component: engine
2016-06-08 21:59:34 +02: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
3cbc347e63 Merge pull request #23148 from mlaventure/wait-for-containerd-before-restarting-it
Wait for containerd to die before restarting it
Upstream-commit: cb36dddad150a3bc0986736a877c8bdfcfbd346c
Component: engine
2016-06-01 10:35:31 -07:00
e66ae89f7b Merge pull request #23142 from Microsoft/ExtraCleanup
Windows: Remove a double free on hcs container handle
Upstream-commit: bcf0c8ca2883867ba7dcec4824a64359ee7cab12
Component: engine
2016-06-01 11:09:06 -04:00
a612268e81 Wait for containerd to die before restarting it
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: ce160b37e15ddb86c45314d080718f833e551aa3
Component: engine
2016-06-01 07:45:03 -07:00
9c661aedc4 Merge pull request #22989 from Microsoft/StartCleanup
Windows: Adding missing cleanup call when container start fails
Upstream-commit: c7aba69cc10faee84ba877ad4a94e4e150cb0932
Component: engine
2016-06-01 15:42:47 +02:00
b9c6d22ba9 Set --state-dir on containerd.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 8b5e5c61955eba9af7c2975b959c4f4517485389
Component: engine
2016-05-31 11:48:05 -07:00
1ed90a29aa Windows: Remove a double free on hcs container handle
Signed-off-by: Darren Stahl <darst@microsoft.com>
Upstream-commit: c8454394f76865777d4cd013c606d17dcd0f9600
Component: engine
2016-05-31 10:25:38 -07:00
7a3282f5c8 Windows: Adding missing cleanup call when container start fails
Signed-off-by: Darren Stahl <darst@microsoft.com>
Upstream-commit: 054992e2913cf10171eecb5f41e5c19158cf04bc
Component: engine
2016-05-31 10:19:05 -07:00
c9cc850112 Fix a leaked process handle of the first container to start on Windows
Signed-off-by: Darren Stahl <darst@microsoft.com>
Upstream-commit: 717209c9ffc5caa4782dfda39e7be9a7b581a42c
Component: engine
2016-05-25 21:33:50 -07:00
37e80ffc41 Windows: Use image version, not OS version for TTY fixup
A previous change added a TTY fixup for stdin on older Windows versions to
work around a Windows issue with backspace/delete behavior. This change
used the OS version to determine whether to activate the behavior.
However, the Windows bug is actually in the image, not the OS, so it
should have used the image's OS version.

This ensures that a Server TP5 container running on Windows 10 will have
reasonable console behavior.

Signed-off-by: John Starks <jostarks@microsoft.com>
Upstream-commit: 6508c015fe764fd59438cabffcbc6102c9cf04ef
Component: engine
2016-05-25 12:22:52 -07:00
ecdb255cd3 Merge pull request #22958 from Microsoft/hcs_rpc
Windows: Use the new HCS RPC API
Upstream-commit: c7ee50308290d56b70933dfd83bd70e3a9df93d5
Component: engine
2016-05-25 09:25:22 -07:00
d8cc018311 Change Docker to use the new HCS RPC API
Signed-off-by: Darren Stahl <darst@microsoft.com>
Upstream-commit: 959c1a52bf11dd6b3e65f10bbaa867bfabba6838
Component: engine
2016-05-24 16:36:51 -07:00
12513175c8 Merge pull request #22091 from amitkris/build_solaris
Get the Docker Engine to build clean on Solaris
Upstream-commit: 86a7632d63bdddb95aaf1472648056a4fb737d38
Component: engine
2016-05-24 21:41:36 +02:00
d6f4430048 Merge pull request #22541 from crosbymichael/graph-restore
Implement graph driver restore on reboot
Upstream-commit: d7dfe9103bfc275494d936a5d89f3067b0aedbc9
Component: engine
2016-05-23 22:57:23 -07:00
3a35464d9d Get the Docker Engine to build clean on Solaris
Signed-off-by: Amit Krishnan <krish.amit@gmail.com>
Upstream-commit: 86d8758e2bb5e9d21d454ceda90b33feb8e74771
Component: engine
2016-05-23 16:37:12 -07:00
e6822e5504 Remove restart test
This test is not applicable anymore now that containers are not stopped
when the daemon is restored.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 31e903b0e17d01a4240f7890218a80088d32658c
Component: engine
2016-05-23 15:57:23 -07:00
2b52cbdf3e Restore ref count
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 009ee16beff4f6d3607fa251019908cc72ce0a34
Component: engine
2016-05-23 15:57:23 -07:00
fc3bf55518 Windows: Work around Windows BS/DEL behavior
In Windows containers in TP5, DEL is interpreted as the delete key, but
Linux generally interprets it as backspace. This prevents backspace from
working when using a Linux terminal or the native console terminal
emulation in Windows.

To work around this, translate DEL to BS in Windows containers stdin when
TTY is enabled. Do this only for builds that do not have the fix in
Windows itself.

Signed-off-by: John Starks <jostarks@microsoft.com>
Upstream-commit: f124829c9b35377de2a8316b7e23aa7a8c5d7b23
Component: engine
2016-05-20 19:04:20 -07:00
58e7931a34 Fixing Windows update logic.
Removing the call to Shutdown from within Signal in order to rely on waitExit handling the exit of the process.

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
Upstream-commit: a5b64f2847501bc377c77a989df060646f2d87f8
Component: engine
2016-05-12 17:45:53 -07:00
e7146eaec9 Merge pull request #22544 from Microsoft/jjh/terminate
Windows: Terminate on failed shutdown, fixes dockerd deadlock
Upstream-commit: e811e9784fd95069e9d5e14960e04cb0499ccd1d
Component: engine
2016-05-12 14:46:56 -07:00
3f5fe19aa9 Windows: Terminate on failed shutdown
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: feacb1205b2cf9166e75e707d7b5fa2d09e80e03
Component: engine
2016-05-10 10:09:50 -07:00
dbf25e32d6 Fix containerd proto for connection
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 6889c3276c6895a8440dc8883b8cd608793199f3
Component: engine
2016-05-09 15:17:10 -07:00
cf5ef9f29e Merge pull request #22046 from cpuguy83/containerd_stdio
Set containerd pdeathsig
Upstream-commit: 9a9ebc7f85319fabbdcc98cfed10d77ac896f0f1
Component: engine
2016-05-06 09:26:16 +02:00
591507ba0c Set Pdeathsig for containerd on SIGKILL
Makes sure containerd exits (when started by docker) if docker gets
SIGKILL'd.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: d4559313d5b0284bf2544d83e6431873c06f8349
Component: engine
2016-05-02 14:23:38 -04:00
f770cdfb66 Remain extra \n on INFO log msg
Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 1e44bba4af6c417e10cbf7aa459a8225dfb89d6c
Component: engine
2016-04-27 05:19:40 -07:00
452a7d0ba9 Adding servicing update to postRunProcessing for Windows containers.
This change enables the workflow of finishing installing Windows OS updates in the container after it has completed running, via a special servicing container.

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
Upstream-commit: da92dad59f76421a22a955d2aed25bfeb4562385
Component: engine
2016-04-25 12:16:26 -07:00
e49ce8b3dd Merge pull request #22125 from crosbymichael/restart-timeout
Reset restart timeout if execution longer than 10s
Upstream-commit: 17d5c97c900d90bee7a1ba4182bf9ea51e5c386d
Component: engine
2016-04-25 19:15:32 +02:00
423557cc6f Merge pull request #22256 from mlaventure/use-abs-rootfs-path
Use absolute path for rootfs in OCI config.json
Upstream-commit: 885e5eb5f7784f9e5d218d4446595609f83304a8
Component: engine
2016-04-23 13:21:21 +02:00
c197f20a8a Reset restart timeout if execution longer than 10s
Restore the 1.10 logic that will reset the restart manager's timeout or
backoff delay if a container executes longer than 10s reguardless of
exit status or policy.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: b6db56b5eba00c4e8ad7a6f6c5b018e15dc883eb
Component: engine
2016-04-22 10:37:34 -07:00
cab428e780 Use absolute path for rootfs in OCI config.json
This avoid an extra bind mount within /var/run/docker/libcontainerd

This should resolve situations where a container having the host
/var/run bound prevents other containers from being cleanly removed
(e.g. #21969).

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: 313587454334f455334dac8d32cfb96f949a29a0
Component: engine
2016-04-22 10:07:33 -07:00
50fc6aee46 Fix config cleanup on canceling restartmanager
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 7bf07737b90f087271b5a9a3a1c8d262c154554f
Component: engine
2016-04-21 15:33:09 -07:00
aeb44b5505 Merge pull request #22171 from mlaventure/always-disable-metrics
Always disable containerd metrics when started by docker
Upstream-commit: ccf83c94d18df4b27ca3d46ffbe008df76aa3275
Component: engine
2016-04-21 01:38:07 +02:00
a950119eaf Always disable containerd metrics when started by docker
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: 42f9c25b5168e3bc8e19003cd8bfd4eabbad654c
Component: engine
2016-04-19 13:37:18 -07:00
0a813c13d3 Merge pull request #22123 from crosbymichael/restart-canceled
Remove restart canceled error
Upstream-commit: ab6b82b85668eaa5be5ee1ba04febfae5fcec433
Component: engine
2016-04-19 16:28:33 -04:00
ba66548e04 Remove restart canceled error
It should not be an error to call a common option to cancel restarts.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: fc2e2234c614379d21c16e32c1b82e7819fc3eac
Component: engine
2016-04-19 10:46:21 -07:00
089a9530bf Merge pull request #22121 from tonistiigi/fix-exec-cleanup
Clean up exec fifos on process exit
Upstream-commit: 2f7df8e5dec7c4ab121d0ea0d337b5cc4c3d5c77
Component: engine
2016-04-19 09:45:54 -07:00
b394d53e14 Clean up exec fifos on process exit
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 84d170129a19855829d282e5416ce08ddb2edbd6
Component: engine
2016-04-18 14:03:37 -07:00
93eb6e71f1 Merge pull request #21993 from coolljt0725/quiet_restartmanger_cancel
Don't throw "restartmanager canceled" error for no restart policy container
Upstream-commit: a4030787f537e79242888cc3fd8b5f3f51ce357f
Component: engine
2016-04-18 14:38:01 -04:00
f63a31e0b9 Remove rpc error when shut down daemon
RPC connection closing error will be reported every time we shutdown
daemon, this error is expected, so we should remove this error to avoid
confusion to user.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: a02ae66d361464cc24bec4fb6aa5778c9d5b8cda
Component: engine
2016-04-16 16:53:33 +08:00
d060054c87 Don't throw "restartmanager canceled" error for no restart policy container
Don't throw "restartmanager canceled" error for no restart policy container
and add the container id to the warning message if a container has restart policy
and has been canceled.

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: 494297baf8f391ce73cdc2e885a335a266261970
Component: engine
2016-04-14 21:40:20 -04:00