Commit Graph

3392 Commits

Author SHA1 Message Date
fbb8bd9e59 Merge pull request #23338 from vdemeester/23253-fix-create-run
Fix create command flags
Upstream-commit: 8cd6977f98f4f51ee110a9795d1d93b9ec4b166c
Component: engine
2016-06-07 10:46:45 -07:00
94abb34940 add support for filtering by network ID
This adds support for filtering by network ID, to be
consistent with other filter options.

Note that only *full* matches are returned; this is
consistent with other filters (e.g. volume), that
also return full matches only.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 7c46ba02e694ae540866b29ebf0dab76e556cc13
Component: engine
2016-06-07 16:50:31 +02:00
4e024e3e7d Adding network filter to docker ps command
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Upstream-commit: 912af1ae8f22c4d9d7e478d0985a40b41ded2027
Component: engine
2016-06-07 16:43:11 +02:00
3cb88d591b Fix TestRenameInvalidName
Change the test back to what it was before
e83dad090a1e890ac870808d776fa584276bf7ab

And added an extra test-case to check the
output if an incorrect number of arguments
is passed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 085f41b6a5764cba33fb5bda387f8ebe165d5828
Component: engine
2016-06-07 15:42:48 +02:00
a25abf1b60 Fix create command flags
Any command that expects extra flags after positional args needs to set flags.SetInterspersed(false).

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: aa00520fc8bb4e04c37c2eb41f3bc3558deab533
Component: engine
2016-06-07 14:11:11 +02:00
08ad8f3172 Merge pull request #23269 from vdemeester/migrate-import-to-cobra
Use spf13/cobra for docker import
Upstream-commit: f061f556f2d3819f293e76a434c8212d613eca6b
Component: engine
2016-06-07 13:07:30 +02:00
54aa4a7bec Merge pull request #22149 from vdemeester/deprecated-copy-endpoint
Deprecate /containers/(id or name)/copy endpoint
Upstream-commit: 148d2b8e4a7e4f669ba9e8db2adc2413fde27a07
Component: engine
2016-06-07 12:50:04 +02:00
582dec773d Merge pull request #23172 from michael-holzheu/PR-s390x-seccomp
Enable seccomp for s390x and ppc: s390x part
Upstream-commit: eb6b5a6448efe7a9450abb98f9a0ea1c4cf51913
Component: engine
2016-06-07 12:04:13 +02:00
5879215fd4 Merge pull request #23226 from HackToday/fixnetinspectId
Fix the network inspect id
Upstream-commit: f9021838b61f17b2de6c42e459a732652ee2d207
Component: engine
2016-06-07 10:02:17 +02:00
d313694ba9 Merge pull request #23290 from yongtang/23211-spf13-cobra-rename
Use spf13/cobra for docker rename
Upstream-commit: e83dad090a1e890ac870808d776fa584276bf7ab
Component: engine
2016-06-07 08:28:27 +02:00
69e243a9fc Merge pull request #23274 from WeiZhang555/cobra-attach
Move attach command to cobra
Upstream-commit: ab821f9f9bf15cb7d356c6e48729f706807488db
Component: engine
2016-06-06 21:16:45 -04:00
83ae608b78 Use spf13/cobra for docker rename
This fix is part of the effort to convert commands to spf13/cobra #23211.

Thif fix coverted command `docker rename` to use spf13/cobra

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 70f7ccb304f9246bc9c2bfe0e30d3a2bd8fd42f8
Component: engine
2016-06-06 12:39:11 -07:00
0c22cb98b8 Merge pull request #23217 from clnperez/speedup-pushfail-tests
test trusted push: use a nonexistant hostname
Upstream-commit: 4f1c5772a8da16ac66fbf838b782af76fa4185a6
Component: engine
2016-06-06 10:12:42 -07:00
cfcc9cde2b Fix the network inspect id
This fixes #22231

Signed-off-by: Kai Qiang Wu(Kennan) <wkqwu@cn.ibm.com>
Upstream-commit: 864e362aa05ed2207d71471780068e951fe9d02e
Component: engine
2016-06-06 15:26:07 +00:00
9a954be4f2 Move attach command to cobra.
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: eceb8625a94e3504fca7b27d8156bcf11a93bf4f
Component: engine
2016-06-06 22:28:57 +08:00
5cb7befa00 Enable seccomp for s390x
To implement seccomp for s390x the following changes are required:

1) seccomp_default: Add s390 compat mode

   On s390x (64 bit) we can run s390 (32 bit) programs in 32 bit
   compat mode. Therefore add this information to arches().

2) seccomp_default: Use correct flags parameter for sys_clone on s390x

   On s390x the second parameter for the clone system call is the flags
   parameter. On all other architectures it is the first one.

   See kernel code kernel/fork.c:

   #elif defined(CONFIG_CLONE_BACKWARDS2)
   SYSCALL_DEFINE5(clone, unsigned long, newsp, unsigned long, clone_flags,
                   int __user *, parent_tidptr,

   So fix the docker default seccomp rule and check for the second
   parameter on s390/s390x.

3) seccomp_default: Add s390 specific syscalls

  For s390 we currently have three additional system calls that should
  be added to the seccomp whitelist:

  - Other architectures can read/write unprivileged from/to PCI MMIO memory.
    On s390 the instructions are privileged and therefore we need system
    calls for that purpose:

    * s390_pci_mmio_write()
    * s390_pci_mmio_read()

  - Runtime instrumentation:

    * s390_runtime_instr()

4) test_integration: Do not run seccomp default profile test on s390x

   The generated profile that we check in is for amd64 and i386
   architectures and does not work correctly on s390x.

   See also: 75385dc216e ("Do not run the seccomp tests that use
   default.json on non x86 architectures")

5) Dockerfile.s390x: Add "seccomp" to DOCKER_BUILDTAGS

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Upstream-commit: bf2a577c131d8998eb6ecac986d80e1289e6c801
Component: engine
2016-06-06 08:13:22 -04:00
b9600bdf73 Fix TestDiffEmptyArgClientError O:)
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 7878705dcc26804b5f6a562410aecdb8f3485b91
Component: engine
2016-06-06 13:58:29 +02:00
62fb401985 Migrate network command to cobra
- Migrates network command and subcommands (connect, create, disconnect,
  inspect, list and remove) to spf13/cobra
- Create a RequiredExactArgs helper function for command that require an
  exact number of arguments.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 4bd202b00f7859ebeb4ba87511a0618ad08d0605
Component: engine
2016-06-06 10:28:52 +02:00
fd0727c3a3 Merge pull request #22077 from cpuguy83/remote_volplugin_caps
Add support for volume scopes
Upstream-commit: 28dde09cdf2a48dcdb6ce665cd2b912175dfb871
Component: engine
2016-06-06 10:15:43 +02:00
bbcce85205 Merge pull request #23283 from yongtang/23211-spf13-cobra-diff
Use spf13/cobra for docker diff
Upstream-commit: 2becfab55fd8ad6ec1d02aea3cd6498a2f91ef68
Component: engine
2016-06-06 09:05:18 +02:00
03f6e5fc67 Merge pull request #23242 from vdemeester/migrate-rmi-to-cobra
Use spf13/cobra for docker rmi
Upstream-commit: e94be2f639804c5223ebb127faec845683410eb1
Component: engine
2016-06-05 15:29:01 -07:00
9c145d0655 Use spf13/cobra for docker diff
This fix is part of the effort to convert commands to spf13/cobra #23211.

Thif fix coverted command `docker diff` to use spf13/cobra

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 5899afae52b10d2457848c6e62a7476835befef3
Component: engine
2016-06-05 15:13:55 -07:00
1a2a5dd2e3 Merge pull request #23280 from icecrime/remove_num_commands_test
Remove unnecessary check for number of commands
Upstream-commit: 951702a5679b5220bfb02497bc76b65137dff1e3
Component: engine
2016-06-05 23:25:48 +02:00
7339550c4b Use spf13/cobra for docker rmi
Moves image command rmi to `api/client/image/remove.go` and use cobra :)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 60e48bd6bd24c559ed92c7217cd7798c85cbb644
Component: engine
2016-06-05 22:40:35 +02:00
78cd3d76ac Merge pull request #23247 from thaJeztah/carry-22033-docker-ps-format-output
[Carry 22033] Add a check for size field in custom format string
Upstream-commit: 1a1083ae75ac0b1018510ab80bffeab415220886
Component: engine
2016-06-05 16:39:22 -04:00
da4d783e80 Add support for volume scopes
This is similar to network scopes where a volume can either be `local`
or `global`. A `global` volume is one that exists across the entire
cluster where as a `local` volume exists on a single engine.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 2f40b1b281a3be8f34d82a5170988ee46ea1f442
Component: engine
2016-06-05 15:37:15 -04:00
472381db0b Remove unnecessary check for number of commands
Testing for the number of commands in `help` output doesn't seem to
contribute much to the quality of the project, and adds additional
burden for the developer to update.

Signed-off-by: Arnaud Porterie (icecrime) <arnaud.porterie@docker.com>
Upstream-commit: dd7e59a40a4c93070f71adb3ec74021241586c21
Component: engine
2016-06-05 11:44:50 -07:00
86b04a6a8a Merge pull request #22489 from Microsoft/jjh/shell
Builder shell configuration
Upstream-commit: df1dd1322d5c9527be7187038ca3480404b1282b
Component: engine
2016-06-05 17:43:12 +02:00
cfe1b2e499 Merge pull request #23253 from vdemeester/carry-pr-23159
Carry #23159 : Use spf13/cobra for `docker run` and `docker create`
Upstream-commit: 6b4a46f28266031ce1a1315f17fb69113a06efe1
Component: engine
2016-06-04 18:55:23 +02:00
30f6f65a88 Merge pull request #23254 from thaJeztah/prepare-for-go-1.7
Bump engine-api 772250a752e34cacaeef7c92b8e0ddf43450b629, prepare for go 1.7
Upstream-commit: e975dadaa01de9e651f30ef11ffbc59473f07ae5
Component: engine
2016-06-04 16:07:27 +02:00
f790d372b6 Update TestHttpsInfoRogueCert for Go 1.7
The error message changed from

  remote error: bad certificate

To

  remote error: tls: bad certificate

In Go 1.7, so just checking for "bad certificate"
to make this test work on both Go 1.6 and 1.7

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 496adadcec4ba00d230e546239ddc10e4ea41dcf
Component: engine
2016-06-04 14:17:24 +02:00
30e84b2a8a Merge pull request #23248 from Microsoft/jjh/flakeytest
Windows: Turn off TestBuildDockerignoreComment
Upstream-commit: 843720257baf80659729fc5fef5495fe2f7ca170
Component: engine
2016-06-04 14:07:52 +02:00
27d26eeb56 Convert 'docker create' to use cobra and pflag
Return the correct status code on flag parsins errors.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 5ab24342258c70438ab8edf708ebc466b1677f38
Component: engine
2016-06-04 13:57:30 +02:00
47fe12cae3 Merge pull request #23241 from vdemeester/migrate-search-to-cobra
Use spf13/cobra for docker search
Upstream-commit: 521f79bf0e81fdc5ff87ab207b834e2beef4e790
Component: engine
2016-06-03 22:07:08 -04:00
d5ece41dcd Builder default shell
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: b18ae8c9ccc2eb6cf8aa947f25eb6f1d20089776
Component: engine
2016-06-03 13:54:31 -07:00
35da93382d Merge pull request #23234 from yongtang/23221-utf8-bom
Skip UTF-8 BOM bytes from Dockerfile and .dockerignore if exist
Upstream-commit: 2d40e36af89b24b03ec9a502652f713353cf600a
Component: engine
2016-06-03 22:28:48 +02:00
3aae74c466 Windows: Turn off TestBuildDockerignoreComment
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: d75aaa2ca07eb9d0ea464ac503080177091b3b1c
Component: engine
2016-06-03 13:23:35 -07:00
69ba7aeaeb Add a check for size field in custom format string
This fix addresses an issue where including the `{{.Size}}` format
field in conjunction with `docker ps --format`, without the `--size`
flag, would not correctly display the size of containers.

This is done by doing a check on the custom format string, and setting
the size flag on the options struct if the field is found. This struct
gets passed to the engine API which then generates the correct query.

An integration test is included which runs `docker ps --format "table
{{.Size}}"` without `--size`, and checks that the returned output is
not `0 B`.

Fixes #21991

As suggested by @cpuguy83, a parser is implemented to process the format
string as a template, and then traverses the template tree to determine
if `.Size` was called.

This was then reworked by making use of template execution with a
pre-processor struct that will set the `--size` option if the template
calls for the field.

The pre-processor now also sets a boolean in the context passed to the
writer. There is an integration test for this that calls `docker ps
--size --format "{{.Size}}"` and then checks that `size: {{.Size}}` is
not appended, as it would with previous behavior.

Finally, a change was made to the formatter to not automatically
add a `{{.Size}}` if a custom format is provided.

Signed-off-by: Paulo Ribeiro <paigr.io@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 55cdb6dcd0f709301573ddb9f3348f9288572b91
Component: engine
2016-06-03 21:59:10 +02:00
cb2dd312aa Use spf13/cobra for docker search
- Move image command search to `api/client/image/search.go`
- Use cobra :)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: a11ef10631dd9338aeda2e10fedea365a7471af1
Component: engine
2016-06-03 19:50:01 +02:00
27654930fa Deprecate /containers/(id or name)/copy endpoint
This endpoint has been deprecated since 1.8. Return an error starting
from this API version (1.24) in order to make sure it's not used for the
next API version and so that we can remove it some times later.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 428328908dc529b1678fb3d8b033fb0591a294e3
Component: engine
2016-06-03 19:38:03 +02:00
79342b784b Merge pull request #22898 from WeiZhang555/add-detach-event
Add detach event
Upstream-commit: c80a2f2937463882c2c38141a710f19b608125e6
Component: engine
2016-06-03 09:49:48 -07:00
ab25cb22b0 Skip UTF-8 BOM bytes from Dockerignore if exist
This fix tries to address issues related to #23221 where Dockerignore
may consists of UTF-8 BOM. This likely happens when Notepad
tries to save a file as UTF-8 in Windows.

This fix skips the UTF-8 BOM bytes from the beginning of the
Dockerignore if exists.

Additional tests has been added to cover the changes in this fix.

This fix is related to #23221 (UTF-8 BOM in Dockerfile).

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: ea86320fcc61ea9ded3eef7ba01699c4e3ccf3ce
Component: engine
2016-06-03 07:26:36 -07:00
9f25ee3061 trusted push test: Use a nonexistant hostname
Before, the TCP handshake had to time out (approx 30s) before
this test completed. If you use a hostname that doesn't resolve,
then it fails faster.

Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
Upstream-commit: 431e7b65733f2eb627bf69502355a66a35121e04
Component: engine
2016-06-03 08:41:58 -05:00
2c68691b95 Skip UTF-8 BOM bytes from Dockerfile if exists
This fix tries to address issues in #23221 where Dockerfile
may consists of UTF-8 BOM. This likely happens when Notepad
tries to save a file as UTF-8 in Windows.

This fix skips the UTF-8 BOM bytes from the beginning of the
Dockerfile if exists.

Additional tests has been added to cover the changes in this
fix.

This fix fixes #23221.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 678c80f9256021ce74184fdd6b612d9dea377fba
Component: engine
2016-06-03 06:16:50 -07:00
604319f9f2 Merge pull request #23107 from yongtang/23055-docker-search-limit
Add `--limit` option to `docker search`
Upstream-commit: 020a86b3d9e6b052a3f866b7517eb0f62fd24bea
Component: engine
2016-06-03 14:25:42 +02:00
57f1cfe3b1 Add detach event
If we attach to a running container and stream is closed afterwards, we
can never be sure if the container is stopped or detached. Adding a new
type of `detach` event can explicitly notify client that container is
detached, so client will know that there's no need to wait for its exit
code and it can move forward to next step now.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: 83ad006d4724929ccbde4bdf768374fad0eeab44
Component: engine
2016-06-03 11:59:11 +08:00
82d7e1ba5d Add --limit option to docker search
This fix tries to address the issue raised in #23055.
Currently `docker search` result caps at 25 and there is
no way to allow getting more results (if exist).

This fix adds the flag `--limit` so that it is possible
to return more results from the `docker search`.

Related documentation has been updated.

Additional tests have been added to cover the changes.

This fix fixes #23055.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 92f10fe228c1b4b527b87ac47401132322283ea3
Component: engine
2016-06-02 19:12:20 -07:00
3dff30ced8 Add support for comment in .dockerignore
This fix tries to address the issue raised in #20083 where
comment is not supported in `.dockerignore`.

This fix updated the processing of `.dockerignore` so that any
lines starting with `#` are ignored, which is similiar to the
behavior of `.gitignore`.

Related documentation has been updated.

Additional tests have been added to cover the changes.

This fix fixes #20083.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 8913dace341c8fc9f9a3ab9518c8521c161b307f
Component: engine
2016-06-02 19:06:52 -07:00
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