Commit Graph

627 Commits

Author SHA1 Message Date
ff72d92410 Add builtin nodes discovery
Use `pkg/discovery` to provide nodes discovery between daemon instances.

The functionality is driven by two different command-line flags: the
experimental `--cluster-store` (previously `--kv-store`) and
`--cluster-advertise`. It can be used in two ways by interested
components:

1. Externally by calling the `/info` API and examining the cluster store
   field. The `pkg/discovery` package can then be used to hit the same
   endpoint and watch for appearing or disappearing nodes. That is the
   method that will for example be used by Swarm.
2. Internally by using the `Daemon.discoveryWatcher` instance. That is
   the method that will for example be used by libnetwork.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: 7d193ef1f3b5fcd6aa55b7376116e2617be12e06
Component: engine
2015-09-25 14:52:09 -07:00
88a3d0ed92 client/search: small logic fix
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
Upstream-commit: 19613feddf0043756a42a1766abde33a47c346dc
Component: engine
2015-09-24 11:11:03 +08:00
4422b77499 Merge pull request #16415 from HuKeping/dockerinfo
Format output of docker info
Upstream-commit: 40e856041265d6030768286f1b228f042c0f768b
Component: engine
2015-09-23 21:15:23 -04:00
9890a83a8f Merge pull request #16484 from HuKeping/history-format
Format the output of docker history
Upstream-commit: d71ae4577293e6600447433126f4034d80d85ddb
Component: engine
2015-09-23 16:52:21 -07:00
4429613429 Merge pull request #16289 from cpuguy83/11957_fix_stdin_block_after_container_exit
Ensure stdin does not block after container stop
Upstream-commit: c0c941627a2a516ce540aac2d9e3d579baa3efde
Component: engine
2015-09-23 15:29:48 -07:00
75633de557 Format output of docker info
Format those info which will only be displayed when daemon is
in debug mode.

Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: 141e91c4803124bdf55dd45a06998748b0ef5fb2
Component: engine
2015-09-23 14:35:13 +08:00
a5107b7eb0 Format the output of docker history
Once there have '\t' in the "CREATED BY" section, it will possibly
cause a messy output of docker history.

Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: 6353f3a7b58fe7ef1cb33660003c1d7205f2e6c0
Component: engine
2015-09-22 21:27:20 +08:00
f5dba44987 Merge pull request #15864 from dmcgowan/notary-offline
Support content trust offline
Upstream-commit: a7e23cab8d10003914e39f1c954278c7be6bd759
Component: engine
2015-09-21 21:11:36 -07:00
f1430df5ab Merge pull request #16404 from duglin/FixRenameError
Fix 'rename' error msg and error checking
Upstream-commit: 0c71c192395e259d76a51e08c7c3bd73eb6f16e7
Component: engine
2015-09-21 15:51:02 -04:00
8e71940329 add docker server version to /info
Signed-off-by: Zhang Kun <zkazure@gmail.com>
Upstream-commit: 7cf343d1064e3d8211597c67574ff4ddff316fa1
Component: engine
2015-09-21 21:15:32 +08:00
4168ba7ed4 docker restarts running OR stopped containers, docs edit rm "running"
Signed-off-by: Sally O'Malley <somalley@redhat.com>
Upstream-commit: e41753678d5ffd6c505f1984943bc36d34e134bb
Component: engine
2015-09-20 09:16:27 -04:00
3a09d2b95a Fix 'rename' error msg and error checking
`docker rename foo ''` would result in:
```
usage: docker rename OLD_NAME NEW_NAME
```
which is the old engine's way of return errors - yes that's in the
daemon code.  So I fixed that error msg to just be normal.

While doing that I noticed that using an empty string for the
source container name failed but didn't print any error message at all.
This is because we would generate a URL like: ../containers//rename/..
which would cause a 301 redirect to ../containers/rename/..
however the CLI code doesn't actually deal with 301's - it just ignores
them and returns back to the CLI code/caller.

Rather than changing the CLI to deal with 3xx error codes, which would
probably be a good thing to do in a follow-on PR, for this immediate
issue I just added a cli-side check for empty strings for both old and
new names. This way we catch it even before we hit the daemon.

API callers will get a 404, assuming they follow the 301, for the
case of the src being empty, and the new error msg when the destination
is empty - so we should be good now.

Add tests for both cases too.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 848792c42e61070adc4107a39d6a044e2ed615f7
Component: engine
2015-09-18 11:12:22 -07:00
3194323cdb Ensure stdin does not block after container stop
Fixes #11957
Fixes #12319

Also removes check for Darwin when the stdin reader is closed as it
doesn't appear to block any more.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 3dbfb3d38c4dcfb602e12ed2828d22d155897518
Component: engine
2015-09-18 13:48:07 -04:00
5be2b08002 Reset data of stats in docker cli when container stopped
When use `docker stats` to minitor a running container and then stop it,
there are some fields need to be reset to zero. Otherwise it will keep
displaying the data it received last time.

Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: da67833e63f317d8f20ffed5c3250f442900bdae
Component: engine
2015-09-18 15:24:13 +08:00
b0bf51095d Merge pull request #16336 from mountkin/fix-hijack
error should be checked earlier in the hijack function
Upstream-commit: ffaee8fe78a5e7203b28895788e2aa16b4315b21
Component: engine
2015-09-17 09:38:48 +02:00
267460c20b error should be checked earlier in the hijack function
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
Upstream-commit: f2d978ccf9ae29aa8ac06791ac0ffeceb4167d9b
Component: engine
2015-09-16 20:28:07 +08:00
ded3de600a Support for passing build-time variables in build context
- The build-time variables are passed as environment-context for command(s)
run as part of the RUN primitve. These variables are not persisted in environment of
intermediate and final images when passed as context for RUN. The build environment
is prepended to the intermediate continer's command string for aiding cache lookups.
It also helps with build traceability. But this also makes the feature less secure from
point of view of passing build time secrets.

- The build-time variables also get used to expand the symbols used in certain
Dockerfile primitves like ADD, COPY, USER etc, without an explicit prior definiton using a
ENV primitive. These variables get persisted in the intermediate and final images
whenever they are expanded.

- The build-time variables are only expanded or passed to the RUN primtive if they
are defined in Dockerfile using the ARG primitive or belong to list of built-in variables.
HTTP_PROXY, HTTPS_PROXY, http_proxy, https_proxy, FTP_PROXY and NO_PROXY are built-in
variables that needn't be explicitly defined in Dockerfile to use this feature.

Signed-off-by: Madhav Puri <madhav.puri@gmail.com>
Upstream-commit: 54240f8da9992880e20a1508e9a6f0e59f2adef1
Component: engine
2015-09-16 03:31:15 -07:00
c71aa53e3d Refactor the statistics of network in docker stats
For now docker stats will sum the rxbytes, txbytes, etc. of all
the interfaces.

It is OK for the output of CLI `docker stats` but not good for
the API response, especially when the container is in sereval
subnets.

It's better to leave these origianl data to user.

Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: d3379946ec96fb6163cb8c4517d7d5a067045801
Component: engine
2015-09-15 15:40:34 +08:00
1f4f6c3414 Merge pull request #15931 from vdemeester/api-client-ps-coverage
Add more unit tests on api/client/ps package
Upstream-commit: 7ce270d4ea17d5ec01fe00581fbabf4c5274f0e1
Component: engine
2015-09-14 14:02:49 -07:00
0dc44a70e4 Ignore ping errors in notary repository setup
Notary is capable of acting in offline mode, making use of cache TUF data.
When ping is not successful, notary should still be attempted without error.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 5e11cd43aa21a9d0eb1f5f205f05dc7b14ee4d43
Component: engine
2015-09-14 11:08:25 -07:00
862065b3b2 Add log reading to the journald log driver
If a logdriver doesn't register a callback function to validate log
options, it won't be usable.  Fix the journald driver by adding a dummy
validator.

Teach the client and the daemon's "logs" logic that the server can also
supply "logs" data via the "journald" driver.  Update documentation and
tests that depend on error messages.

Add support for reading log data from the systemd journal to the
journald log driver.  The internal logic uses a goroutine to scan the
journal for matching entries after any specified cutoff time, formats
the messages from those entries as JSONLog messages, and stuffs the
results down a pipe whose reading end we hand back to the caller.

If we are missing any of the 'linux', 'cgo', or 'journald' build tags,
however, we don't implement a reader, so the 'logs' endpoint will still
return an error.

Make the necessary changes to the build setup to ensure that support for
reading container logs from the systemd journal is built.

Rename the Jmap member of the journald logdriver's struct to "vars" to
make it non-public, and to make it easier to tell that it's just there
to hold additional variable values that we want journald to record along
with log data that we're sending to it.

In the client, don't assume that we know which logdrivers the server
implements, and remove the check that looks at the server.  It's
redundant because the server already knows, and the check also makes
using older clients with newer servers (which may have new logdrivers in
them) unnecessarily hard.

When we try to "logs" and have to report that the container's logdriver
doesn't support reading, send the error message through the
might-be-a-multiplexer so that clients which are expecting multiplexed
data will be able to properly display the error, instead of tripping
over the data and printing a less helpful "Unrecognized input header"
error.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com> (github: nalind)
Upstream-commit: e611a189cb3147cd79ccabfe8ba61ae3e3e28459
Component: engine
2015-09-11 16:50:03 -04:00
b7b1e671cd Refactor CLI docker save
Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: 22be1e443fa49bafd6aa3ab6c1eb0595fd9fb2b1
Component: engine
2015-09-11 15:31:55 +08:00
5e00b6c763 Merge pull request #14626 from kunalkushwaha/add-network-cli-help
"docker network" missing from docker --help
Upstream-commit: a796ac53185c2827017843fec21e02aba88f6ace
Component: engine
2015-09-09 13:36:43 -07:00
b744bb23c3 Use TrimSpace to instead of Trim
String.Trim(string, " ") can only get ride of the blank, but actully we need
to remove all leading and trailing white space include "\t" for example.

Prior to this patch, one can login with "[Tab][Tab]username", and it will
not be consider as the same with "username".

Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: e9602f3561b78313c4d474a8d950f7cc562637e8
Component: engine
2015-09-09 19:37:33 +08:00
d879adf33b Add --help to "docker volume inspect --help" output
Closes #16146

While in there, modified the testing infrastructure for the help text
so that we can get commands with nested commands - like "volume".

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 87255b6721f4dc02ae34696f2013537fdc967a99
Component: engine
2015-09-08 14:24:00 -07:00
c50d0a0555 Fix usage for docker volume inspect and docker volume rm
For both commands, volume is _not_ optional. Several volumes may
be specified.
Both commands now use the same name (VOLUME) for the command argument.

Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: 00eaa7e1f53d9100e95af80d8a05f8e77e380464
Component: engine
2015-09-08 09:14:57 -07:00
c805d1d6a5 Merge pull request #14488 from HuKeping/fixstats
Fix connection block when using docker stats API
Upstream-commit: 5f5d73d51591ca0db893e53bddbe3bbd370624e2
Component: engine
2015-09-08 10:01:11 -04:00
f91e0804c7 Make RegistryConfig a typed value in the api.
Remove possible circular dependency that prevented us from using a real
type.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 719886d4352cba3f2cd0092e052bb4cb67d51417
Component: engine
2015-09-07 19:29:33 -04:00
5c5ecbbc35 Complete unit tests on api/client/ps package
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 6baf65d1a69b6e07861c3db5b5f6ed3b8256b4a8
Component: engine
2015-09-06 22:05:57 +02:00
d4738db561 Fix connection block when using docker stats API
For now CLI `docker stats` will not block even if the container was
not running is because there is a 2s timeout setting when waiting for
the response.

I think why we hang there waiting for the container to run is because we
want to get the stats of container immediately when it starts running.
But it will block when use the API directly, for example
- curl
- Google Chrome plugin, Postman
- Firefox plugin, RESTClient

This patch keeps the feature that getting info immediately when container
starts running and in the meantime, it will not block when using the API
directrly.

Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: d9bf8163ad8579cf2ab9f55925f9ea5037e5b525
Component: engine
2015-09-06 17:21:41 +08:00
b8b3d17b1b "docker network" missing from docker --help
Fixed issues related to network subcommand tests
- "network" in exempted list of short help check
- Condition for exact test modified to meet experimental commands
- Sorting of commands done in flags_experimental

Signed-off-by: Kunal Kushwaha <kunal.kushwaha@gmail.com>
Upstream-commit: 44da5c3de2c763c4bc42a74051ad7a37adf1f553
Component: engine
2015-09-04 15:34:17 +09:00
68cefd3677 Fix typo
Signed-off-by: Adrien Gallouët <agallouet@gmail.com>
Upstream-commit: 01059cba78be1796c2152dea53d7f0461aaba1da
Component: engine
2015-09-02 10:43:49 +02:00
49e7160994 Windows: Fix absolute checks
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 49c1b51ae22e54edc2e13f3195583e47b987fc15
Component: engine
2015-09-01 08:41:37 -07:00
062cf19d08 Fix docker volume invalid so it displays usage
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 38da43184d9353d1924ff8cd5bcedcf82ca6b008
Component: engine
2015-08-27 09:46:05 -04:00
bfe1bbc7d2 Add volume API/CLI
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: b3b7eb2723461b1eb4be692f4bced0ae8ea9cb58
Component: engine
2015-08-26 13:37:52 -04:00
1a3f9a1f39 api/client/restart.go:Fix a typo in comment
Signed-off-by: Yingqian Hu <choleraehyq@gmail.com>
Upstream-commit: d30990d7b1468488768847521a3a7ce66a081015
Component: engine
2015-08-26 18:59:56 +08:00
15378abfc2 adding message option to the import subcommand
Signed-off-by: Taylor Jones <monitorjbl@gmail.com>
Upstream-commit: 936b2c6afe490b562df4ebea854b116c3b40a9f5
Component: engine
2015-08-25 02:55:04 +00:00
fc4db8ccd2 Fix docker stats show blkio when there are multiple block devices.
Signed-off-by: Lei Jiang <leijitang@huawei.com>
Upstream-commit: 211449a1cad317e80610e40c9d8c88df35cae60d
Component: engine
2015-08-20 11:46:21 +08:00
f00550c0b6 Merge pull request #15599 from calavera/ps_format_q
Fix ignore `-q` flag in `docker ps` when there is a default format.
Upstream-commit: 29ced5d0c4d67b3609c95bc039589009086852b3
Component: engine
2015-08-17 15:44:28 -07:00
ff003f32f9 Merge pull request #15356 from Microsoft/10662-uncpathonbuild
Windows: Allow UNC paths on build
Upstream-commit: 436fca704f7cf14b85d1b9324033a1a778d75134
Component: engine
2015-08-17 13:34:27 -07:00
f3a123c54b Windows: Allow UNC paths on build
Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
Upstream-commit: df7ab6f3dbec85c1cf32b36c4c7dcfdc374f6566
Component: engine
2015-08-17 11:03:54 -07:00
4c6bab5f50 Fix ignore -q flag in docker ps when there is a default format.
Docker ps default format should not take precedence over cli flags.
This happens effectively for other flags except `-q`.
We need to let the cli to set the format as table to print the
expected output with `-q`.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: df46bfdd4d28dcab432b2fc6c36131ff95223148
Component: engine
2015-08-17 10:48:04 -07:00
d024131050 Fix #8048 : make docker images repository:tag work
Make command like "docker images ubuntu:14.04" work and filter out the
image with the given tag.

Closes #8048.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 4fb88d2e11f2f16c520b36e4c6e00db44ae26b8c
Component: engine
2015-08-13 08:50:09 +02:00
8120b4d8fe Change all docker -d to docker daemon
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: 81cc8ebc93c20537d5fab4c016a3774f58b3e483
Component: engine
2015-08-10 20:48:08 +08:00
a7b91c7783 Merge pull request #15421 from maaquib/15418-ps-image-id-too-wide
Truncating image id is docker ps to a length of 12
Upstream-commit: cc73fc03e8fe8d339e0be89dd2ad8eda9d06262b
Component: engine
2015-08-08 07:48:16 -04:00
f2606dcb4e Typo: remove unconsistent period in docker info
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: dc2a7ab7504fb334e4285b24b280a3a49ed33096
Component: engine
2015-08-08 13:06:59 +08:00
f2c4f16feb Remove useless if-else
It is better to use simple form without else.

Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: c536cec5ea8026b6d93ad53d10bdd2a2cf523d03
Component: engine
2015-08-08 20:02:44 +08:00
2b85b35ea0 Truncating image id to 12 in docker ps
Signed-off-by: Mohammed Aaqib Ansari <maaquib@gmail.com>
Upstream-commit: 1a2ccf59eefc14c6bd5abb23f0556ffc5c77bacf
Component: engine
2015-08-07 20:53:48 -04:00
b0a38c37db Merge pull request #15370 from cpuguy83/better_error_on_client_connect
Better/more specific error messages on connect
Upstream-commit: 0262d40ba7d2edc67077a17aebbcdca1e2472a1e
Component: engine
2015-08-07 13:00:44 -07:00
c8706706f4 Merge pull request #14897 from WeiZhang555/golint-api-types
fix golint warnings/errors on package api/types/
Upstream-commit: 0a0e9701f7bbe58e75eff9d1934fde0a5038ee9c
Component: engine
2015-08-07 10:51:27 -07:00