Commit Graph

27 Commits

Author SHA1 Message Date
6b04858e42 Refactor stdin closing
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 6f2658fb8cbaf5972c4c069817ed16e80d461514
Component: engine
2016-10-20 17:10:15 -07:00
dd35c23542 record pid of exec'd process
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 18083481361a4053d1081a201120a916239fc0ed
Component: engine
2016-10-20 17:06:11 +02:00
bf1e1cd730 Exec: Add ability to set environment variables
Keeping the current behavior for exec, i.e., inheriting
variables from main process. New variables will be added
to current ones. If there's already a variable with that
name it will be overwritten.

Example of usage: docker exec -it -e TERM=vt100 <container> top

Closes #24355.

Signed-off-by: Jonh Wendell <jonh.wendell@redhat.com>
Upstream-commit: e03bf1221ee2c863f25a57af4d415e2d8ff4f26c
Component: engine
2016-10-19 12:39:25 -02:00
97516856c4 Remove restartmanager from libcontainerd
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 606a245d8548e98e889df1b9cf511b5953a309b9
Component: engine
2016-10-07 12:09:54 -07:00
455b5fdd43 add lock in libcontainerd client AddProcess
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 278273bc1699873304240a6eca342b54051e2f23
Component: engine
2016-10-02 00:36:25 +08:00
434bea436a Remove hacked Windows OCI spec, compile fixups
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 02309170a5fb97d40260d0ee9e24b44be8c780b2
Component: engine
2016-09-27 12:07:35 -07:00
7bef93723c Initial implementation of containerd Checkpoint API.
Signed-off-by: boucher <rboucher@gmail.com>
Upstream-commit: d8fef66b03c1ea8715470690efbd950033f7f628
Component: engine
2016-09-08 21:31:52 -04:00
6c683fac48 Replace old oci specs import with runtime-specs
Fixes #25804

The upstream repo changed the import paths.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 041e5a21dc0a8856448e3a9ad91e8535b8a7d00d
Component: engine
2016-08-17 09:38:34 -07:00
8e4d2991bb Handle out-of-sync libcontainerd client on restore
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: 51f21a1674c60108f97878815046c69f769cee48
Component: engine
2016-07-28 11:26:07 -07:00
665067dce6 Check if the container is running if no event
When there is no event for the container it can happen because of a
crash and the container state on the persistent disk will have a
mismatch between what was in `/run` ( machine crash ).

This situation will create an unkillable container in docker because
containerd does not see it and it is not running but docker thinks it is
and you cannot tell it anything different.

This fixes the issue by checking if containerd has the container running
if we do not have an event instead of just returning.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 2650b1b6abd87d7d888e27abd6110dea83dcd080
Component: engine
2016-07-28 11:17:02 -07:00
e4e65a85a5 Fix daemon panic on restoring containers
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: c75de8e33cc0db5236eef6146f2de06533b46aa8
Component: engine
2016-07-26 22:52:52 -04:00
0000093b60 Fix missing unlock in libcontainerd.Restore()
This was preventing the "exit" event to be correctly processed during
the restore process without live-restore enabled.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: ac068a1f9de2b20b145b5682cd514c1f6b1fac17
Component: engine
2016-07-22 15:21:10 -07:00
1dd4a36c0e Prepend libcontainerd log message with "libcontainerd:"
This will make it easier to pinpoint error messages in the daemon
logs.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: 5231c5534679206e20672ca16bbee5c10d699319
Component: engine
2016-07-22 15:20:14 -07:00
ac1b563dd3 Update libcontainerd.AddProcess to accept a context
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: c02f82756e914081543bf05cb1815a48c02b1ebd
Component: engine
2016-07-19 08:24:39 -07:00
32ecbd59e9 Do not rely on "live" event anymore
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: 64483c3bdaa1887b8b932e0564362fbbff025dc0
Component: engine
2016-07-19 08:24:39 -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
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
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
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
1a5ffe3e32 Fix critical bug: can't restart a restarting container
When user try to restart a restarting container, docker client report
error: "container is already active", and container will be stopped
instead be restarted which is seriously wrong.

What's more critical is that when user try to start this container
again, it will always fail.

This error can also be reproduced with a `docker stop`+`docker start`.

And this commit will fix the bug.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: a705e166cf3bcca62543150c2b3f9bfeae45ecfa
Component: engine
2016-04-08 22:02:30 +08:00
6a3a5e1d71 Fix typo
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: 5fdbce3185913b82f516938deedb954c612d7d5d
Component: engine
2016-04-07 12:46:55 +08:00
a1edae7884 Adding postRunProcessing infrastructure for hanlding Windows Update.
Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
Upstream-commit: 818a5198e4a76cd63ff84a7796ff3b0b91302552
Component: engine
2016-04-06 14:03:05 -07:00
e716bd46e9 Add ulimit support to libcontainerd addprocess
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 8891afd8385aeb490f8b7d9db8c3828bc7d24dc1
Component: engine
2016-03-23 19:54:32 -07:00
d4fa46cb38 Windows: Minimal docker top implementation
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 52237787fa82c12b018d71b1e00f28492be35dad
Component: engine
2016-03-20 16:45:53 -07:00
8ba16d91c8 Replace execdrivers with containerd implementation
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 9c4570a958df42d1ad19364b1a8da55b891d850a
Component: engine
2016-03-18 13:38:32 -07:00