Граф коммитов

3258 Коммитов

Автор SHA1 Сообщение Дата
Derek McGowan e896d1d7c4 Add support for identity token with token handler
Use token handler options for initialization.
Update auth endpoint to set identity token in response.
Update credential store to match distribution interface changes.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-03-09 13:47:57 -08:00
Solganik Alexander 1a40dd535f Fixes #18712. Add rfc5424 log format for syslog.
Previously docker used obsolete rfc3164 syslog format for syslog. rfc3164 explicitly
uses semicolon as a separator between 'TAG' and 'Content' section of the log message.
Docker uses semicolon as a separator between image name and version tag.
When {{.ImageName}} was used as a tag expression and contained ":" syslog parser mistreated
"tag" part of the image name as syslog message body, which resulted in incorrect "syslogtag" been reported by syslog
daemon.
Use of rfc5424 log format partually fixes the issue as it does not use semicolon as a separator.
However using default rfc5424 syslog format itroduces backward incompatability because rsyslog template keyword  %syslogtag%
is parsed differently. In rfc3164 it uses the "TAG" part reported before the "pid" part. In rfc5424 it uses "appname" part reported
before the pid part, while tag part is introduced by %msgid% part.
For more information on rsyslog configuration properties see: http://www.rsyslog.com/doc/master/configuration/properties.html

Added two options to specify logging in either rfc5424, rfc3164 format or unix format omitting hostname in order to keep backwards compatability with
previous versions.

Signed-off-by: Solganik Alexander <solganik@gmail.com>
2016-03-09 22:31:11 +02:00
Tõnis Tiigi f97ab358cb Merge pull request #21013 from calavera/events_since_nano
Compare event nanoseconds properly to filter since a specific date.
2016-03-09 09:30:54 -08:00
Antonio Murdaca 3d09842713 Merge pull request #21033 from estesp/workdir-perms-userns
Ensure WORKDIR is created with remapped root ownership
2016-03-09 07:22:08 +01:00
David Calavera a9f2006f10 Compare event nanoseconds properly to filter since a specific date.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-03-08 17:07:58 -05:00
David Calavera dd32445ecc Merge pull request #18697 from jfrazelle/pids-cgroup
Add PIDs cgroup support to Docker
2016-03-08 14:03:36 -08:00
Brian Goff dc702b6c6b Merge pull request #20727 from mrunalp/no_new_priv
Add support for NoNewPrivileges in docker
2016-03-08 14:26:15 -05:00
Phil Estes 799a6b94ee Ensure WORKDIR is created with remapped root ownership
Correct creation of a non-existing WORKDIR during docker build to use
remapped root uid/gid on mkdir

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2016-03-08 11:58:55 -05:00
Jessica Frazelle 69cf03700f
pids limit support
update bash commpletion for pids limit

update check config for kernel

add docs for pids limit

add pids stats

add stats to docker client

Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2016-03-08 07:55:01 -08:00
Qiang Huang a444b5f60c Fix race condition when exec with tty
I can reproduce this easily on one of my servers,
`docker exec -ti my_cont ls` will not print anything,
without `-t` it acts normally.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-03-08 10:53:34 +08:00
Vivek Goyal 2e222f69b3 devmapper: Add a new option dm.min_free_space
Once thin pool gets full, bad things can happen. Especially in case of xfs
it is possible that xfs keeps on retrying IO infinitely (for certain kind
of IO) and container hangs. 

One way to mitigate the problem is that once thin pool is about to get full,
start failing some of the docker operations like pulling new images or
creation of new containers. That way user will get warning ahead of time
and can try to rectify it by creating more free space in thin pool. This
can be done either by deleting existing images/containers or by adding more
free space to thin pool.

This patch adds a new option dm.min_free_space to devicemapper graph
driver. Say one specifies dm.min_free_space=10%. This means atleast
10% of data and metadata blocks should be free in pool before new device
creation is allowed, otherwise operation will fail.

By default min_free_space is 10%. User can change it by specifying
dm.min_free_space=X% on command line. A value of 0% will disable the
check.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2016-03-07 20:27:39 +00:00
Mrunal Patel 74bb1ce9e9 Add support for NoNewPrivileges in docker
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>

Add tests for no-new-privileges

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>

Update documentation for no-new-privileges

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-03-07 09:47:02 -08:00
David Calavera 1a729c3dd8 Do not wait for container on stop if the process doesn't exist.
This fixes an issue that caused the client to hang forever if the
process died before the code arrived to exit the `Kill` function.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-03-04 16:00:58 -05:00
David Calavera 2af84d8875 Merge pull request #20934 from icecrime/20543_debugging
Fix race condition on daemon shutdown (#20543)
2016-03-04 11:08:50 -08:00
Antonio Murdaca 8142ebb0be Merge pull request #20834 from rhatdan/relabelvolume
Do not relabel if user did not request it for non local volumes
2016-03-04 13:17:54 +01:00
Arnaud Porterie ad2fa39459 Fix race in container creation
Only register a container once it's successfully started. This avoids a
race condition where the daemon is killed while in the process of
calling `libcontainer.Container.Start`, and ends up killing -1.

There is a time window where the container `initProcess` is not set, and
its PID unknown. This commit fixes the race Engine side.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2016-03-03 20:25:03 -08:00
Tatsushi Inagaki e8513675a2 Aufs: reduce redundant parsing of mountinfo
Check whether or not the file system type of a mountpoint is aufs
by calling statfs() instead of parsing mountinfo. This assumes
that aufs graph driver does not allow aufs as a backing file
system.

Signed-off-by: Tatsushi Inagaki <e29253@jp.ibm.com>
2016-03-04 11:39:59 +09:00
David Calavera b7bc1ce1a4 Merge pull request #20730 from clnperez/sysinfo-match-ip-case
Match case for IP variables in sysinfo pkg
2016-03-03 08:48:57 -08:00
Sebastiaan van Stijn 15e68dc8ee Merge pull request #20863 from thaJeztah/add-kernel-memory-warning
Add KernelMemory to "info" and show warning
2016-03-03 13:14:51 +01:00
Sebastiaan van Stijn b76a55308f Merge pull request #20882 from Microsoft/jstarks/new_windows_diff_format
Write Windows layer diffs to tar in standard format
2016-03-03 10:51:35 +01:00
John Starks 5649030e25 Write Windows layer diffs to tar in standard format
Previously, Windows layer diffs were written using a Windows-internal
format based on the BackupRead/BackupWrite Win32 APIs. This caused
problems with tar-split and tarsum and led to performance problems
in implementing methods such as DiffPath. It also was just an
unnecessary differentiation point between Windows and Linux.

With this change, Windows layer diffs look much more like their
Linux counterparts. They use AUFS-style whiteout files for files
that have been removed, and they encode all metadata directly in
the tar file.

This change only affects Windows post-TP4, since changes to the Windows
container storage APIs were necessary to make this possible.

Signed-off-by: John Starks <jostarks@microsoft.com>
2016-03-02 16:13:40 -08:00
Sebastiaan van Stijn 747a486b4a Add KernelMemory to "info" and show warning
This change adds "KernelMemory" to the /info endpoint and
shows a warning if KernelMemory is not supported by the kernel.

This makes it more consistent with the other memory-limit
options.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-03-02 23:32:25 +01:00
Vincent Demeester 508a17baba Merge pull request #20388 from hqhq/hq_add_cgroup_driver_info
Add CgroupDriver to docker info
2016-03-02 23:17:27 +01:00
Vincent Demeester b65fd8e879 Merge pull request #20858 from mountkin/validate-log-opts-again
validate log-opt when creating containers AGAIN (fixing drunkard's code)
2016-03-02 18:27:00 +01:00
David Calavera 8f109829e2 Merge pull request #20475 from Microsoft/jstarks/filegetter
graphdriver: Replace DiffPath with DiffGetter
2016-03-02 08:36:36 -08:00
Shijiang Wei 068085005e validate log-opt when creating containers AGAIN
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2016-03-02 20:30:26 +08:00
Qiang Huang ca89c329b9 Add CgroupDriver to docker info
Fixes: #19539

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-03-02 20:07:06 +08:00
Sebastiaan van Stijn 3c4d093bab Merge pull request #18766 from mikedanese/gcplogs
Add logging driver for Google Cloud Logging
2016-03-02 02:09:44 +01:00
Dan Walsh 843a119d49 Do not relabel if user did not request it for non local volumes
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2016-03-01 17:09:42 -05:00
Arnaud Porterie 106793dcbe Merge pull request #20825 from LK4D4/unused
Remove some unused structs and fields
2016-03-01 12:58:35 -08:00
Tibor Vass 36401f20ce Merge pull request #20617 from nalind/journald-pkgconfig
Try to handle changing names for journal packages
2016-03-01 15:38:03 -05:00
John Starks 58bec40d16 graphdriver: Replace DiffPath with DiffGetter
This allows a graph driver to provide a custom FileGetter for tar-split
to use. Windows will use this to provide a more efficient implementation
in a follow-up change.

Signed-off-by: John Starks <jostarks@microsoft.com>
2016-03-01 10:25:33 -08:00
Alexander Morozov 0a352e1a90 Remove some unused structs and fields
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-03-01 09:59:29 -08:00
Brian Goff d883002fac Merge pull request #20684 from yongtang/13840-follow-symlink
Follow symlink for --device argument.
2016-03-01 12:44:10 -05:00
Christy Perez 5b3fc7aab2 Match case for variables in sysinfo pkg
I noticied an inconsistency when reviewing docker/pull/20692.

Changing Ip to IP and Nf to NF.

More info: The golang folks recommend that you keep the initials consistent:
https://github.com/golang/go/wiki/CodeReviewComments#initialisms.

Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
2016-03-01 10:37:05 -06:00
Mike Danese ed1b9fa07a daemon/logger: Add logging driver for Google Cloud Logging
Signed-off-by: Mike Danese <mikedanese@google.com>
2016-03-01 08:06:10 -08:00
Yong Tang 7ed569efdc Follow symlink for --device argument.
Fixes: #13840

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-03-01 07:16:19 +00:00
hsinko 772f5495b7 folders->directories
Signed-off-by: hsinko <21551195@zju.edu.cn>
2016-02-29 21:32:30 -08:00
Brian Goff 6a96006959 Merge pull request #20710 from Microsoft/sjw/tp4retry_fix
Fixing retry hack for TP4 to return errors in all failure cases.
2016-02-29 19:08:24 -05:00
Vincent Demeester 9eb4575f8c Merge pull request #20480 from wenchma/20431-filter_since_before
Enhancement of docker ps before and since filters
2016-02-29 20:57:43 +01:00
Stefan J. Wernli 0b82202fbb Fixing retry hack for TP4 to return errors in all failure cases.
Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
2016-02-29 10:53:01 -08:00
David Calavera ba5a282a83 Merge pull request #20605 from mountkin/optimize-json-log-writer
make the json log writer much faster
2016-02-29 10:47:46 -08:00
Brian Goff 2391794d26 Merge pull request #20749 from mountkin/validate-log-opts
validate log-opt when creating containers
2016-02-29 13:47:25 -05:00
Sebastiaan van Stijn b211e57f23 Merge pull request #20774 from hqhq/hq_vender_engine_api
Vendor engine-api to 70d266e96080e3c3d63c55a4d8659e00ac1f7e6c
2016-02-29 18:48:55 +01:00
Qiang Huang 53b0d62683 Vendor engine-api to 70d266e96080e3c3d63c55a4d8659e00ac1f7e6c
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-02-29 19:28:37 +08:00
Vincent Demeester 20a038eca6 Merge pull request #20604 from coolljt0725/fix_reload
Fix configuration reloading
2016-02-29 07:14:15 +01:00
Shijiang Wei 7285c9a53a validate log-opt when creating containers
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2016-02-28 01:51:46 +08:00
Brian Goff e386dfc33f fix double-lock
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-02-27 09:49:21 -05:00
Brian Goff c2f7777603 Revert "Add finer-grained locking for aufs"
This reverts commit f31014197c.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-02-27 08:01:19 -05:00
David Calavera df2b74188e Merge pull request #20699 from calavera/remove_static_error_declarations
Remove static errors from errors package.
2016-02-26 16:30:12 -08:00
Alexander Morozov 2f797bb1d9 Merge pull request #20275 from cpuguy83/finer_graph_locks
Finer graph locks
2016-02-26 13:33:34 -08:00
Alexander Morozov 51302c29ed Merge pull request #20729 from estesp/pipework
Add synchronization and closure to IO pipes in userns path
2016-02-26 13:33:02 -08:00
David Calavera a793564b25 Remove static errors from errors package.
Moving all strings to the errors package wasn't a good idea after all.

Our custom implementation of Go errors predates everything that's nice
and good about working with errors in Go. Take as an example what we
have to do to get an error message:

```go
func GetErrorMessage(err error) string {
	switch err.(type) {
	case errcode.Error:
		e, _ := err.(errcode.Error)
		return e.Message

	case errcode.ErrorCode:
		ec, _ := err.(errcode.ErrorCode)
		return ec.Message()

	default:
		return err.Error()
	}
}
```

This goes against every good practice for Go development. The language already provides a simple, intuitive and standard way to get error messages, that is calling the `Error()` method from an error. Reinventing the error interface is a mistake.

Our custom implementation also makes very hard to reason about errors, another nice thing about Go. I found several (>10) error declarations that we don't use anywhere. This is a clear sign about how little we know about the errors we return. I also found several error usages where the number of arguments was different than the parameters declared in the error, another clear example of how difficult is to reason about errors.

Moreover, our custom implementation didn't really make easier for people to return custom HTTP status code depending on the errors. Again, it's hard to reason about when to set custom codes and how. Take an example what we have to do to extract the message and status code from an error before returning a response from the API:

```go
	switch err.(type) {
	case errcode.ErrorCode:
		daError, _ := err.(errcode.ErrorCode)
		statusCode = daError.Descriptor().HTTPStatusCode
		errMsg = daError.Message()

	case errcode.Error:
		// For reference, if you're looking for a particular error
		// then you can do something like :
		//   import ( derr "github.com/docker/docker/errors" )
		//   if daError.ErrorCode() == derr.ErrorCodeNoSuchContainer { ... }

		daError, _ := err.(errcode.Error)
		statusCode = daError.ErrorCode().Descriptor().HTTPStatusCode
		errMsg = daError.Message

	default:
		// This part of will be removed once we've
		// converted everything over to use the errcode package

		// FIXME: this is brittle and should not be necessary.
		// If we need to differentiate between different possible error types,
		// we should create appropriate error types with clearly defined meaning
		errStr := strings.ToLower(err.Error())
		for keyword, status := range map[string]int{
			"not found":             http.StatusNotFound,
			"no such":               http.StatusNotFound,
			"bad parameter":         http.StatusBadRequest,
			"conflict":              http.StatusConflict,
			"impossible":            http.StatusNotAcceptable,
			"wrong login/password":  http.StatusUnauthorized,
			"hasn't been activated": http.StatusForbidden,
		} {
			if strings.Contains(errStr, keyword) {
				statusCode = status
				break
			}
		}
	}
```

You can notice two things in that code:

1. We have to explain how errors work, because our implementation goes against how easy to use Go errors are.
2. At no moment we arrived to remove that `switch` statement that was the original reason to use our custom implementation.

This change removes all our status errors from the errors package and puts them back in their specific contexts.
IT puts the messages back with their contexts. That way, we know right away when errors used and how to generate their messages.
It uses custom interfaces to reason about errors. Errors that need to response with a custom status code MUST implementent this simple interface:

```go
type errorWithStatus interface {
	HTTPErrorStatusCode() int
}
```

This interface is very straightforward to implement. It also preserves Go errors real behavior, getting the message is as simple as using the `Error()` method.

I included helper functions to generate errors that use custom status code in `errors/errors.go`.

By doing this, we remove the hard dependency we have eeverywhere to our custom errors package. Yes, you can use it as a helper to generate error, but it's still very easy to generate errors without it.

Please, read this fantastic blog post about errors in Go: http://dave.cheney.net/2014/12/24/inspecting-errors

Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-26 15:49:09 -05:00
Phil Estes 995386735c Add synchronization and closure to IO pipes in userns path
The execdriver pipes setup uses OS pipes with fds so that they can be
chown'ed to the remapped root user for proper access. Recent flakiness
in certain short-lived tests (usually via the "exec" path) reveals that
the copy routines are not completing before exit/tear-down.

This fix adds synchronization and proper closure such that these
routines exit successfully.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2016-02-26 13:47:34 -05:00
Brian Goff c47674efda Merge pull request #20428 from jfrazelle/generate-conversion
generate seccomp profile convert type
2016-02-26 10:28:23 -05:00
Brian Goff 6748cc10ac Merge pull request #20655 from hqhq/hq_fix_update_memoryswap
Fix problems when update swap memory
2016-02-25 22:28:53 -05:00
Brian Goff f31014197c Add finer-grained locking for aufs
```
benchmark                       old ns/op       new ns/op     delta
BenchmarkConcurrentAccess-8     10269529748     26834747      -99.74%

benchmark                       old allocs     new allocs     delta
BenchmarkConcurrentAccess-8     309948         7232           -97.67%

benchmark                       old bytes     new bytes     delta
BenchmarkConcurrentAccess-8     23943576      1578441       -93.41%
```

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-02-25 18:06:41 -05:00
Brian Goff 55c91f2ab9 Fix some issues with concurrency in aufs.
Adds a benchmark to measure performance under concurrent actions.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-02-25 14:32:13 -05:00
Vincent Demeester 13b6733ee8 Merge pull request #20685 from estesp/userns-dev-fuse-fix
Filter auto-created device list if user namespaces enabled
2016-02-25 10:01:13 +01:00
Wen Cheng Ma bc72883fe1 Enhancement of docker ps before and since filters
This enhancement is to fix the wrong list results on
`docker ps` before and since filters specifying the non-running container.

Fixes issue #20431

Signed-off-by: Wen Cheng Ma <wenchma@cn.ibm.com>
2016-02-25 16:58:31 +08:00
Phil Estes 9a554e8c37 Filter auto-created device list if user namespaces enabled
Because devices will be bind-mounted instead of using `mknod`, we need
to make sure the source exists and filter the list by only those whose
source is a valid path/current device entry.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2016-02-25 00:11:36 -05:00
David Calavera cee4ff1c4a Merge pull request #20647 from coolljt0725/fix_20638
Fix exec start api with detach and AttachStdin at same time. fixes #2…
2016-02-24 20:17:15 -08:00
Lei Jitang b9366c9609 Fix configuration reloading
There are five options 'debug' 'labels' 'cluster-store' 'cluster-store-opts'
and 'cluster-advertise' that can be reconfigured, configure any of these
options should not affect other options which may have configured in flags.
But this is not true, for example, I start a daemon with -D to enable the
debugging, and after a while, I want reconfigure the 'label', so I add a file
'/etc/docker/daemon.json' with content '"labels":["test"]' and send SIGHUP to daemon
to reconfigure the daemon, it work, but the debugging of the daemon is also diabled.
I don't think this is a expeted behaviour.
This patch also have some minor refactor of reconfiguration of cluster-advertiser.
Enable user to reconfigure cluster-advertiser without cluster-store in config file
since cluster-store could also be already set in flag, and we only want to reconfigure
the cluster-advertiser.

Signed-off-by: Lei Jitang <leijitang@huawei.com>
2016-02-24 21:12:14 -05:00
Lei Jitang fb0ac1afd9 Fix exec start api with detach and AttachStdin at same time. fixes #20638
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2016-02-24 21:04:44 -05:00
Alexander Morozov a7fefcf16c Merge pull request #20641 from cpuguy83/revert_inotify_changes
Revert fsnotify changes
2016-02-24 10:10:03 -08:00
Brian Goff f9524a4d24 add file poller panic fix from 1.10.2
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-02-24 10:17:29 -05:00
Sebastiaan van Stijn 034a1a8dfd Merge pull request #20017 from calavera/expose_volumes_in_ps
Add mounts to docker ps.
2016-02-24 11:08:21 +01:00
Qiang Huang fa3b197157 Restore container configs when update failed
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-02-24 14:23:48 +08:00
Qiang Huang 8ae6f6ac28 Support update swap memory only
We should support update swap memory without memory.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-02-24 13:36:47 +08:00
Brian Goff 91fdfdd537 Revert "use pubsub instead of filenotify to follow json logs"
This reverts commit b1594c59f5.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-02-23 21:43:52 -05:00
Nalin Dahyabhai 6cdc4ba6cd Try to handle changing names for journal packages
When checking if we have the development files for libsystemd's journal
APIs, check for either 'libsystemd >= 209' and 'libsystemd-journal'.  If
we find 'libsystemd', define the 'journald' tag, which defaults to using
the 'libsystemd.pc' file.  If we find the older 'libsystemd-journal',
define both the 'journald' and 'journald_compat' tags, which causes the
'libsystemd-journal.pc' file to be consulted instead.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com> (github: nalind)
2016-02-23 12:24:27 -05:00
David Calavera bd4fb00fb6 Add mounts to docker ps.
- Allow to filter containers by volume with `--filter volume=name` and `filter volume=/dest`.
- Show their names in the list with the custom format `{{ .Mounts }}`.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-23 12:10:24 -05:00
Shijiang Wei d7af031114 make the json log writer much faster
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2016-02-23 19:28:06 +08:00
Stefan Weil 2eee613326 Fix some typos in comments and strings
Most of them were found and fixed by codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-02-22 20:27:15 +01:00
Zhang Wei ff3ea4c90f Update RestartPolicy of container
Add `--restart` flag for `update` command, so we can change restart
policy for a container no matter it's running or stopped.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-02-20 17:06:32 +08:00
Tibor Vass 6668326aa8 Merge pull request #20471 from calavera/userland_proxy_config_fix
Avoid setting default truthy values from flags that are not set.
2016-02-19 21:00:37 -05:00
Tibor Vass 3d65e7126c Merge pull request #20446 from estesp/fix-userns-cp
Fix copy chown settings to not default to real root
2016-02-19 19:45:44 -05:00
David Calavera 31cb96dcfa Avoid setting default truthy values from flags that are not set.
When the value for a configuration option in the file is `false`,
and the default value for a flag is `true`, we should not
take the value from the later as final value for the option,
because the user explicitly set `false`.

This change overrides the default value in the flagSet with
the value in the configuration file so we get the correct
result when we merge the two configurations together.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-19 18:39:10 -05:00
Jessica Frazelle ad600239bc
generate seccomp profile convert type
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2016-02-19 13:32:54 -08:00
Arnaud Porterie 117a982d2e Merge pull request #20419 from aboch/cr
Allow passing global datastore to libnetwork and v0.7.0-dev1 vendoring
2016-02-18 17:39:46 -08:00
Phil Estes 40be5dba47 Fix copy chown settings to not default to real root
This corrects `docker cp` behavior when user namespaces are enabled.
Instead of chown'ing copied-in files to real root (0,0), the code
queries for the remapped root uid & gid and sets the chown option
properly.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2016-02-18 14:44:13 -08:00
Alessandro Boch ed364b69df Invoke ReloadConfiguration on network controller
- It reverts fa163f5619 plus a small change
  in order to allow passing the global scope datastore
  to libnetwork after damon boot.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-02-18 12:14:14 -08:00
David Calavera 2e6c841b82 Merge pull request #17513 from aidanhs/aphs-expose-ipv6-default-bridge
Expose bridge IPv6 setting to `docker network inspect`
2016-02-18 10:35:04 -08:00
Brian Goff be5939f407 Merge pull request #20333 from rhatdan/mqueue
/dev/mqueue should never be mounted readonly
2016-02-18 11:02:17 -05:00
David Calavera b26c21f704 Merge pull request #20407 from tiborvass/backmerge-1.10.1
Backmerge 1.10.1 fixes to master
2016-02-17 13:45:43 -08:00
Tonis Tiigi 55080fc03b Don’t stop daemon on migration hard failure
Also changes missing storage layer for container
RWLayer to a soft failure.

Fixes #20147

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 2798d7a6a681aee8995e87c9b68128e54876d2b5)
2016-02-17 14:26:30 -05:00
Phil Estes 5c78515430 Merge pull request #20366 from LK4D4/socks_proxy
Add support for forwarding Docker client through SOCKS proxy
2016-02-16 22:29:49 -08:00
David Calavera c795d0bab9 Merge pull request #19689 from cednation/etwlogs
Windows: Add ETW logging driver plug-in
2016-02-16 15:01:17 -08:00
Alexander Morozov 0f5624d374 Merge pull request #20367 from tonistiigi/fix-import-gzip
Fix docker import on compressed data
2016-02-16 14:09:46 -08:00
Alexander Morozov 8545fdc6dd Merge pull request #19498 from mountkin/refactor-jsonfilelog-reader
use pubsub instead of filenotify to follow json logs
2016-02-16 13:55:48 -08:00
Cedric Davies 3fe60bbf95 Windows: Add ETW logging driver plug-in
Signed-off-by: Cedric Davies <cedricda@microsoft.com>
2016-02-16 13:24:49 -08:00
Tonis Tiigi e1c2eb0d35 Fix docker import on compressed data
Fixes #20296

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-02-16 11:19:23 -08:00
Alexander Morozov 05002c2501 Add support for forwarding Docker client through SOCKS proxy
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-02-16 11:09:28 -08:00
Kai Qiang Wu(Kennan) c33cdf9ee3 Fix the typo
Signed-off-by: Kai Qiang Wu(Kennan) <wkqwu@cn.ibm.com>
2016-02-16 07:00:01 +00:00
Dan Walsh adb2e3fedc /dev/mqueue should never be mounted readonly
If user specifies --read-only flag it should not effect /dev/mqueue.
This is causing SELinux issues in docker-1.10.  --read-only blows up
on SELinux enabled machines.  Mounting /dev/mqueue read/only would also
blow up any tool that was going to use /dev/mqueue.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2016-02-15 14:56:07 -05:00
Shijiang Wei b1594c59f5 use pubsub instead of filenotify to follow json logs
inotify event is trigged immediately there's data written to disk.
But at the time that the inotify event is received, the json line might
not fully saved to disk. If the json decoder tries to decode in such
case, an io.UnexpectedEOF will be trigged.
We used to retry for several times to mitigate the io.UnexpectedEOF error.
But there are still flaky tests caused by the partial log entries.

The daemon knows exactly when there are new log entries emitted. We can
use the pubsub package to notify all the log readers instead of inotify.

Signed-off-by: Shijiang Wei <mountkin@gmail.com>

try to fix broken test. will squash once tests pass

Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2016-02-15 19:25:16 +08:00
Antonio Murdaca 5a9a435d40 Merge pull request #20290 from calavera/fix_stop_signal_merge
Inherit StopSignal from Dockerfile.
2016-02-13 09:26:11 +01:00
Jess Frazelle 79edcc5172 Merge pull request #20198 from cpuguy83/check_drivers_b4_vol_create
Check drivers before vol create
2016-02-12 18:41:48 -05:00
David Calavera a252516ec1 Inherit StopSignal from Dockerfile.
Make sure the image configuration is not overriden by the default
value in the `create` flag.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-12 17:56:40 -05:00
Victor Vieux 99a396902f fix common misspell
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-02-11 15:49:36 -08:00
Aidan Hobson Sayers dfb00652aa Expose bridge IPv6 setting to `docker network inspect`
Signed-off-by: Aidan Hobson Sayers <aidanhs@cantab.net>
2016-02-11 22:13:47 +00:00
David Calavera 803e3d4d1e Merge pull request #20230 from estesp/zfs-ref-counting
Add proper refcounting to zfs graphdriver
2016-02-11 08:27:26 -08:00
Phil Estes 922986b76e Add proper refcounting to zfs graphdriver
Fixes issues with layer remounting (e.g. a running container which then
has `docker cp` used to copy files in or out) by applying the same
refcounting implementation that exists in other graphdrivers like
overlay and aufs.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2016-02-11 01:00:54 -05:00
Brian Goff 00ec6102d9 Probe all drivers if volume driver not specified
This fixes an issue where `docker run -v foo:/bar --volume-driver
<remote driver>` -> daemon restart -> `docker run -v foo:/bar` would
make a `local` volume after the restart instead of using the existing
volume from the remote driver.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-02-10 20:43:15 -05:00
David Calavera dfebb6074f Merge pull request #20210 from Microsoft/jjh/hcswin32-v2
Windows: Revendor HCS to use revised error scheme
2016-02-10 17:20:14 -08:00
John Howard 54263a9393 Windows: Use new error code mechanism from HCS
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-02-10 14:48:24 -08:00
John Howard d4b0732499 Windows: Fix 'isolation'
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-02-10 13:19:19 -08:00
Alexander Morozov 2658341b5f Merge pull request #20205 from calavera/remove_last_daemon_references
Remove daemon dependency from api/server.
2016-02-10 13:13:53 -08:00
David Calavera 1af76ef597 Remove daemon dependency from api/server.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-10 15:16:59 -05:00
John Howard 7853193edb Windows CI: Another reliability fix
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-02-10 11:07:29 -08:00
Tibor Vass 61efb4d084 Merge pull request #20135 from vdemeester/20087-fix-since-before-filters
Fix the since and before filter behavior
2016-02-09 21:13:00 -05:00
Tibor Vass 0b4a7fb06d Merge pull request #20133 from mlaventure/dont-bind-mount-mqueue
Prevent mqueue from implicitely becoming a bind mount with --ipc=host
2016-02-09 19:55:57 -05:00
Kenfe-Mickael Laventure f7d4abdc00 Prevent mqueue from implicitely becoming a bind mount with --ipc=host
Currently, when running a container with --ipc=host, if /dev/mqueue is
a standard directory on the hos the daemon will bind mount it allowing
the container to create/modify files on the host.

This commit forces /dev/mqueue to always be of type mqueue except when
the user explicitely requested something to be bind mounted to
/dev/mqueue.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-02-09 14:16:08 -08:00
Brian Goff a77b7dd227 cleanup attach api calls
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-02-09 14:26:51 -05:00
Brian Goff ae4ee974e8 Move stream flushes to backend
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-02-09 14:25:02 -05:00
Vincent Demeester b41dba58a0 Fix the since and before filter behavior
Filters should not include stopped container if `-a` is not specified.
Right now, before and since filter are acting as --before and --since
deprecated flags. This commit is fixing that.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-02-09 09:26:20 +01:00
Stefan J. Wernli 041a9510c6 Fixing 'docker save' on Windows.
Save was failing file integrity checksums due to bugs in both
Windows and Docker. This commit includes fixes to file time handling
in tarexport and system.chtimes that are necessary along with
the Windows platform fixes to correctly support save. With this
change, sysfile_backups for windowsfilter driver are no longer
needed, so that code is removed.

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
2016-02-08 18:08:49 -08:00
Tibor Vass 8c6887c54d Merge pull request #19772 from calavera/decouple-server-routers
[Carry 19133] Decouple server routers from the daemon package.
2016-02-08 17:54:49 -05:00
Tibor Vass 54b67fe12f Merge pull request #19711 from coolljt0725/fix_19679
Clean up container rootf mounts on daemon start, fixes #19679
2016-02-08 16:21:50 -05:00
David Calavera 06d8f504f7 Move backend types to their own package.
- Remove duplicated structs that we already have in engine-api.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-08 12:42:17 -05:00
Lukas Waslowski dd93571c69 Decouple the "container" router from the actual daemon implementation.
This is done by moving the following types to api/types/config.go:
  - ContainersConfig
  - ContainerAttachWithLogsConfig
  - ContainerWsAttachWithLogsConfig
  - ContainerLogsConfig
  - ContainerStatsConfig

Remove dependency on "version" package from types.ContainerStatsConfig.
Decouple the "container" router from the "daemon/exec" implementation.

* This is done by making daemon.ContainerExecInspect() return an interface{}
value. The same trick is already used by daemon.ContainerInspect().

Improve documentation for router packages.
Extract localRoute and router into separate files.
Move local.router to image.imageRouter.

Changes:
  - Move local/image.go to image/image_routes.go.
  - Move local/local.go to image/image.go
  - Rename router to imageRouter.
  - Simplify imports for image/image.go (remove alias for router package).

Merge router/local package into router package.
Decouple the "image" router from the actual daemon implementation.
Add Daemon.GetNetworkByID and Daemon.GetNetworkByName.
Decouple the "network" router from the actual daemon implementation.

This is done by replacing the daemon.NetworkByName constant with
an explicit GetNetworkByName method.

Remove the unused Daemon.GetNetwork method and the associated constants NetworkByID and NetworkByName.

Signed-off-by: Lukas Waslowski <cr7pt0gr4ph7@gmail.com>
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-08 11:30:57 -05:00
Jess Frazelle e6573a5d18 Merge pull request #19876 from rhatdan/mqueue
Make mqueue container specific
2016-02-08 10:57:15 -05:00
Alexander Morozov 415dd86886 Merge pull request #20078 from cpuguy83/carry_17329
Carry 17329
2016-02-07 08:59:36 -08:00
David Calavera a93cb2b856 Merge pull request #20045 from estesp/zfs-userns-permissions-fix
Fix ZFS permissions bug with user namespaces
2016-02-05 15:32:43 -08:00
Brian Goff 25941b5020 Merge pull request #20003 from liubogithub/btrfs
Graphdriver/btrfs: Avoid using single d.Get()
2016-02-05 16:35:12 -05:00
Phil Estes aef0995b02 Fix ZFS permissions bug with user namespaces
Fix root directory of the mountpoint being owned by real root. This is
unique to ZFS because of the way file mountpoints are created using the
ZFS tooling, and the remapping that happens at layer unpack doesn't
impact this root (already created) holding directory for the layer.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2016-02-05 14:37:33 -05:00
Dan Walsh ba38d58659 Make mqueue container specific
mqueue can not be mounted on the host os and then shared into the container.
There is only one mqueue per mount namespace, so current code ends up leaking
the /dev/mqueue from the host into ALL containers.  Since SELinux changes the
label of the mqueue, only the last container is able to use the mqueue, all
other containers will get a permission denied.  If you don't have SELinux protections
sharing of the /dev/mqueue allows one container to interact in potentially hostile
ways with other containers.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2016-02-05 16:50:35 +01:00
Lei Jitang fae09e2569 Add progress bar to docker load
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2016-02-05 02:24:23 -05:00
Liu Bo b2e27fee53 Graphdriver/btrfs: Avoid using single d.Get()
For btrfs driver, in d.Create(), Get() of parentDir is called but not followed
by Put().

If we apply SElinux mount label, we need to mount btrfs subvolumes in d.Get(),
without a Put() would end up with a later Remove() failure on
"Device resourse is busy".

This calls the subvolume helper function directly in d.Create().

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
2016-02-04 10:25:24 -08:00
Zhang Wei 3c0a91d227 Fix error for restarting container
Fix error message for `--net container:b` and `--ipc container:b`,
container `b` is a restarting container.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-02-04 20:14:50 +08:00
Lei Jitang af614a19dc Clean up container rootf mounts on daemon start fixes #19679
When the daemon shutdown ungracefully, it will left the running
containers' rootfs still be mounted. This will cause some error
when trying to remove the containers.

Signed-off-by: Lei Jitang <leijitang@huawei.com>
2016-02-03 20:52:32 -05:00
Jess Frazelle dcde68b955 Merge pull request #19952 from WeiZhang555/fix-err-restarting-1
Fix error message for pause a restarting container
2016-02-03 17:34:19 -08:00
Jess Frazelle e74c07b947 Merge pull request #19980 from tonistiigi/fix-microsoft-vendor-dir
Remove case sensitive duplicate dir in vendor
2016-02-03 17:32:14 -08:00
Jess Frazelle fdcce4ac03 Merge pull request #19942 from LK4D4/fix_vet_errors
Fix minor vet warnings
2016-02-03 13:31:11 -08:00
Tonis Tiigi b9a395c85d Remove case sensitive duplicate dir in vendor
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-02-03 13:06:32 -08:00
Alexander Morozov 3b80b1947c Merge pull request #19943 from aboch/ec
Store endpoint config on network connect to a stopped container
2016-02-03 11:06:35 -08:00
Alexander Morozov 28a7577a02 Merge pull request #19959 from WeiZhang555/fix-cli-print-err
Remove redundant error message
2016-02-03 10:56:19 -08:00
Alexander Morozov 7a20a270bc Fix minor vet warnings
Also use Asserts where it's possible.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-02-03 10:43:01 -08:00
Phil Estes b2c162a0b3 Merge pull request #19966 from twistlock/user_namespace__unnecessary_text_in_error
user namespaces: duplicate dot in user namespaces error message
2016-02-03 12:51:51 -05:00
Vincent Demeester 98c4f0bbc3 Merge pull request #18966 from mariusGundersen/machine-readable-state
Expose the machine readable state of a container when listing containers
2016-02-03 16:41:45 +01:00
Liron Levin 858f852da4 user namespaces: duplicate dot in user namespaces error message
duplicate dot in user namespaces error message:

$ docker run -ti --net=host ubuntu /bin/bash
docker: Error response from daemon: Cannot share the host or a
container's network namespace when user namespaces are enabled..

Signed-off-by: Liron Levin <liron@twistlock.com>
2016-02-03 16:56:34 +02:00
Sebastiaan van Stijn f37e10aee3 Merge pull request #19961 from coolljt0725/check_nil
1.10.0-rc3: Check nil before set resource.OomKillDisable
2016-02-03 14:52:18 +01:00
Zhang Wei 2c63ac3a97 Fix error message for pause a restarting container
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-02-03 21:20:27 +08:00
Sebastiaan van Stijn b75d0929b1 Merge pull request #19914 from coolljt0725/fix_top_restart
Fix docker top a restarting container
2016-02-03 11:28:10 +01:00
Lei Jitang 09a33b5f60 Check nil before set resource.OomKillDisable
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2016-02-03 04:31:00 -05:00
Zhang Wei 894266c1bb Remove redundant error message
Currently some commands including `kill`, `pause`, `restart`, `rm`,
`rmi`, `stop`, `unpause`, `udpate`, `wait` will print a lot of error
message on client side, with a lot of redundant messages, this commit is
trying to remove the unuseful and redundant information for user.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-02-03 15:45:20 +08:00
Lei Jitang 5566ccb7aa Fix docker top a restarting container
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2016-02-02 21:05:01 -05:00
John Howard 55268f4e91 Windows: Turn off stats
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-02-02 17:59:11 -08:00
Alessandro Boch 9b63e4e7f5 Store endpoint config on network connect to a stopped container
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-02-02 17:25:44 -08:00
Alexander Morozov c2bf90eb59 Merge pull request #19935 from Microsoft/jjh/onemorereliabilityhack
Windows CI: One more reliability hack
2016-02-02 16:49:29 -08:00