Commit graph

3277 commits

Author SHA1 Message Date
Zhang Wei
7ae170ddab 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>
(cherry picked from commit a705e166cf)
2016-04-11 11:19:58 -04:00
Lei Jitang
eb405d2b73 Fix docker stats missing memory limit
Signed-off-by: Lei Jitang <leijitang@huawei.com>
(cherry picked from commit a0a6d031d7)
2016-04-11 11:19:41 -04:00
Zhang Wei
133773a4d0 Add missing "start" event back for auto-restart container
When container is automatically restarted based on restart policy,
docker events can't get "start" event but only get "die" event, this is
not consistent with previous behavior. This commit will add "start"
event back.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
(cherry picked from commit fdfaaeb9aa)
2016-04-11 11:19:41 -04:00
Julio Montes
60be8487c1 Fix compilation errors with btrfs-progs-4.5
btrfs-progs-4.5 introduces device delete by devid
for this reason btrfs_ioctl_vol_args_v2's name was encapsulated
in a union

this patch is for setting btrfs_ioctl_vol_args_v2's name
using a C function in order to preserve compatibility
with all btrfs-progs versions

Signed-off-by: Julio Montes <imc.coder@gmail.com>
(cherry picked from commit a038cccf88)
2016-04-06 18:16:33 -04:00
mYmNeo
5e5e07e106 when container had no layer data, cleanupContainer crashed
Signed-off-by: mYmNeo <thomassong@tencent.com>
(cherry picked from commit 0bfc9c8de0)
2016-04-06 18:16:33 -04:00
Shishir Mahajan
5d1b0aecd0 Ignore os.IsNotExist errors when calling ToDiskLocking
Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
(cherry picked from commit 606cf5310d)
2016-04-06 18:15:51 -04:00
Tonis Tiigi
cc5c9013d9 Define readonly/mask paths in spec
This vendors in new spec/runc that supports
setting readonly and masked paths in the
configuration. Using this allows us to make an
exception for `—-privileged`.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 3f81b49352)
2016-04-06 18:15:37 -04:00
Sebastiaan van Stijn
c17ee39d12 Improve udev unsupported error message
Show a different message if a dynamic binary
is running, but doesn't have udev sync support.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b8f38747e6)
2016-04-06 18:15:19 -04:00
Tonis Tiigi
4b21fdc96a Fix container mount cleanup issues
- Refactor generic and path based cleanup functions into a single function.
- Include aufs and zfs mounts in the mounts cleanup.
- Containers that receive exit event on restore don't require manual cleanup.
- Make missing sandbox id message a warning because currently sandboxes are always cleared on startup. libnetwork#975
- Don't unmount volumes for containers that don't have base path. Shouldn't be needed after #21372

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 05cc737f54)
2016-03-31 18:35:37 -04:00
Anusha Ragunathan
1818ca9d75 Update mount state of live containers after a daemon crash.
Fix unmount issues in the daemon crash and restart lifecycle, w.r.t
graph drivers. This change sets a live container RWLayer's activity
count to 1, so that the RWLayer is aware of the mount. Note that
containerd has experimental support for restore live containers.

Added/updated corresponding tests.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
(cherry picked from commit 511a70583f)
2016-03-31 18:35:37 -04:00
Nalin Dahyabhai
b98f05b4f4 Open the journald following descriptor earlier
Following a journal log almost always requires a descriptor to be
allocated.  In cases where we're running out of descriptors, this means
we might get stuck while attempting to start following the journal, at a
point where it's too late to report it to the client and clean up
easily.  The journal reading context will cache the value once it's
allocated, so here we move the check earlier, so that we can detect a
problem when we can still report it cleanly.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
(cherry picked from commit ab62ecf393)
2016-03-31 18:35:37 -04:00
Nalin Dahyabhai
ed2fcd9a2a Improve error reporting when following journals
When we set up to start following a journal, if we get error results
from sd_journal_get_fd() or sd_journal_get_events() that prevent us from
following the journal, report the error instead of just mysteriously
failing.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com> (github: nalind)
(cherry picked from commit 8d597d25a8)
2016-03-31 18:35:36 -04:00
Anusha Ragunathan
f97f3e98fc When using systemd, pass expected cgroupsPath and cli options to runc.
runc expects a systemd cgroupsPath to be in slice:scopePrefix:containerName
format and the "--systemd-cgroup" option to be set. Update docker accordingly.

Fixes 21475

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
(cherry picked from commit 7ed3d265a4)
2016-03-31 18:35:03 -04:00
Tonis Tiigi
8facb73a8f Protect aufs mounts with locks
Parallel aufs mount calls produce invalid argument error.

Fixes #21545

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 824c24e680)
2016-03-31 18:35:02 -04:00
Robin Naundorf
a17e61c020 Fixes #21538
typo corrected

Signed-off-by: Robin Naundorf <r.naundorf@fh-muenster.de>
(cherry picked from commit a1d6c60ee0)
2016-03-31 18:35:02 -04:00
Tonis Tiigi
4b03e857de Fix wrong variable name on blkio resources
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 8784bd6fde)
2016-03-25 13:43:08 -04:00
Tonis Tiigi
c5e8051c81 Fix setting cgroup permission to user/privileged devices
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit ee61235880)
2016-03-25 13:43:07 -04:00
Brian Goff
6558158dc3 Move layer mount refcounts to mountedLayer
Instead of implementing refcounts at each graphdriver, implement this in
the layer package which is what the engine actually interacts with now.
This means interacting directly with the graphdriver is no longer
explicitly safe with regard to Get/Put calls being refcounted.

In addition, with the containerd, layers may still be mounted after
a daemon restart since we will no longer explicitly kill containers when
we shutdown or startup engine.
Because of this ref counts would need to be repopulated.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 65d79e3e5e)
2016-03-25 13:43:06 -04:00
Anusha Ragunathan
c985e2b84b Fix use of mounted() in overlay.
Handle error and mounted case separately.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
(cherry picked from commit 57ca2a2101)
2016-03-25 13:43:06 -04:00
Tonis Tiigi
e91de9fb9d Revert "Move layer mount refcounts to mountedLayer"
This reverts commit 563d0711f8.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-03-23 00:33:02 -07:00
Lei Jitang
f668e36652 Merge pull request #21407 from LK4D4/log_stats_errors
daemon: log errors from stats calls
2016-03-23 14:12:12 +08:00
Tõnis Tiigi
92a3ece35a Merge pull request #21107 from cpuguy83/one_ctr_to_rule_them_all
Move layer mount refcounts to mountedLayer
2016-03-22 21:19:00 -07:00
Tibor Vass
694b32df51 Merge pull request #21370 from tonistiigi/expose-layer-ids
Expose RootFS in image inspect
2016-03-22 20:33:18 -04:00
Tibor Vass
3ce494f48c Merge pull request #21367 from mlaventure/containerd-docs-cleanup
Remove unneeded references to execDriver
2016-03-22 19:40:27 -04:00
Alexander Morozov
14e1325656 daemon: log errors from stats calls
I encountered silent errors ignoring when runc failed to parse pids.max

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-03-22 14:03:47 -07:00
Tonis Tiigi
14dc4a7158 Expose RootFS in image inspect
Fixes #20451

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-03-22 13:49:30 -07:00
Tibor Vass
53d2e5e9d7 Merge pull request #21270 from ehazlett/resource-labels
Add Label support for Images (build), Networks and Volumes on Creation
2016-03-22 15:12:33 -04:00
David Calavera
62d4556654 Merge pull request #21383 from estesp/shared-userns-net-ipc
Allow net and IPC namespaces to be shared when userns=on
2016-03-22 11:40:12 -07:00
Tibor Vass
de9ff4bdc0 Merge pull request #21223 from cpuguy83/add_nocp_to_vols
Add explicit flags for volume cp/no-cp
2016-03-22 13:45:12 -04:00
Evan Hazlett
fc214b4408 add label support for build, networks and volumes
build: implement --label

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

network: allow adding labels on create

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

volume: allow adding labels on create

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

add tests for build, network, volume

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

vendor: libnetwork and engine-api bump

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2016-03-22 11:49:06 -04:00
Brian Goff
563d0711f8 Move layer mount refcounts to mountedLayer
Instead of implementing refcounts at each graphdriver, implement this in
the layer package which is what the engine actually interacts with now.
This means interacting directly with the graphdriver is no longer
explicitly safe with regard to Get/Put calls being refcounted.

In addition, with the containerd, layers may still be mounted after
a daemon restart since we will no longer explicitly kill containers when
we shutdown or startup engine.
Because of this ref counts would need to be repopulated.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-03-22 11:36:28 -04:00
Arnaud Porterie
9f327b4c28 Merge pull request #21373 from aaronlehmann/client-user-agent-registry-operations
Pass upstream client's user agent through to registry on operations beyond pulls
2016-03-21 21:49:48 -07:00
David Calavera
adc6ed5a10 Merge pull request #21354 from Microsoft/jjh/getpids
Windows: Minimal docker top implementation
2016-03-21 19:59:27 -07:00
Phil Estes
2b278f4846 Allow net and IPC namespaces to be shared when userns=on
Now that the namespace sharing code via runc is vendored with the
containerd changes, we can disable the restrictions on container to
container net and IPC namespace sharing when the daemon has user
namespaces enabled.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2016-03-21 22:20:26 -04:00
Brian Goff
b0ac69b67e Add explicit flags for volume cp/no-cp
This allows a user to specify explicitly to enable
automatic copying of data from the container path to the volume path.
This does not change the default behavior of automatically copying, but
does allow a user to disable it at runtime.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-03-21 20:38:44 -04:00
Aaron Lehmann
c44e7a3e63 Pass upstream client's user agent through to registry on operations beyond pulls
This adds support for the passthrough on build, push, login, and search.

Revamp the integration test to cover these cases and make it more
robust.

Use backticks instead of quoted strings for backslash-heavy string
contstands.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-03-21 14:31:47 -07:00
Arnaud Porterie
278d3962a8 Merge pull request #21306 from mgoelzer/issue20001-nodeps
Pass upstream client's user agent through to registry on image pulls
2016-03-21 14:26:59 -07:00
Alexander Morozov
11b4c89087 Merge pull request #21301 from cpuguy83/cleaner_file_log
Fixes some issues with jsonfile write/read
2016-03-21 14:03:36 -07:00
Kenfe-Mickael Laventure
8af4f89cba Remove unneeded references to execDriver
This includes:
 - updating the docs
 - removing dangling variables

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-03-21 13:06:08 -07:00
Vincent Demeester
d82ad12df8 Merge pull request #19439 from pcarrier/pcarrier/19438-async-connections-to-fluentd
fluentd logger: support all options besides Unix sockets
2016-03-21 18:09:14 +01:00
Arnaud Porterie
2a4c970aeb Merge pull request #21342 from tonistiigi/cleanup-libcontainer
Convert libnetwork stats directly to api types
2016-03-21 08:54:03 -07:00
David Calavera
be8459c248 Merge pull request #21313 from Microsoft/sjw/logs_fix
Fixing logs file handle leak.
2016-03-21 08:41:31 -07:00
David Calavera
336d585292 Merge pull request #21336 from Microsoft/jjh/fixunmount
Windows: Fix unmount for Hyper-V Containers
2016-03-21 08:40:52 -07:00
Brian Goff
1ae9dcf97d Fixes some issues with jsonfile write/read
This cleans up some of the use of the filepoller which makes reading
significantly more robust and gives fewer changes to fallback to the
polling based watcher.
In a lot of cases, if the file was being rotated while we were adding it
to the watcher, it would return an error that the file doesn't exist and
would fallback.
In some cases this fallback could be triggered multiple times even if we
were already on the fallback/poll-based watcher.

It also fixes an open file leak caused by not closing files properly on
rotate, as well as not closing files that were read via the `tail`
function until after the log reader is completed.

Prior to the above changes, it was relatively simple to cause the log
reader to error out by having quick rotations, for example:
```
$ docker run --name test --log-opt max-size=10b --log-opt max-files=10
-d busybox sh -c 'while true; do usleep 500000; echo hello; done'
$ docker logs -f test
```
After these changes I can run this forever without error.

Another fix removes 2 `os.Stat` calls when rotating files. The stat
calls are not needed since we are just calling `os.Rename` anyway, which
will in turn also just produce the same error that `Stat` would.
These `Stat` calls were also quite expensive.
Removing these stat calls also seemed to resolve an issue causing slow
memory growth on the daemon.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-03-21 11:05:58 -04:00
Sebastiaan van Stijn
722f06dae3 Merge pull request #21353 from Microsoft/jjh/tidylibcontainerdmore
Windows: Tidy after libcontainerd
2016-03-21 11:06:54 +01:00
Pierre Carrier
13086f387b fluentd logger: support all options besides Unix sockets
Mostly useful for docker/docker#19438.

Signed-off-by: Pierre Carrier <pierre@meteor.com>
2016-03-21 10:03:21 +00:00
Sebastiaan van Stijn
02a90d0399 Merge pull request #21345 from duglin/BetterError
Add the name of the exe that's trying to be executed
2016-03-21 10:17:10 +01:00
Doug Davis
7942160638 Add the name of the exe that's trying to be executed
so that the user knows what's not in the container but should be.
Its not always easy for the user to know what exact command is being run
when the 'docker run' is embedded deep in something else, like a Makefile.
Saw this while dealing with the containerd migration.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2016-03-20 18:15:46 -07:00
John Howard
52237787fa Windows: Minimal docker top implementation
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-03-20 16:45:53 -07:00
John Howard
3ca6ad5b9e Windows: Tidy after libcontainerd
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-03-20 15:59:52 -07:00