Commit Graph

1159 Commits

Author SHA1 Message Date
1547f964d2 Merge pull request #16497 from MHBauer/attach-refactor-new
refactor attach to not use internal data structures
Upstream-commit: ddd0c47412dd30f1d333b5bd53e22c9949d1e86f
Component: engine
2015-09-23 16:52:39 -07: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
65ae094a39 refactor attach to not use internal data structures
- refactor to make it easier to split the api in the future

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
Upstream-commit: 8aef1a33eb730a7c9b7e92b688bc63e6a3c69f62
Component: engine
2015-09-23 08:55:21 -07:00
6f56efa779 Merge pull request #16331 from calavera/server_middlewares
Organize server pre-func logic in middlewares.
Upstream-commit: 9dc0973655bba2250b906bc8b316d87af809a15e
Component: engine
2015-09-22 16:10:42 -05: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
a91e1506bf Merge pull request #16419 from HuKeping/comments
Comment: add description for some code which hard to understand
Upstream-commit: f97e6f2a374b85c5ef14b19b805991d98a7f3d27
Component: engine
2015-09-21 20:44:54 -07:00
fc5d97018d Comment: add description for some code which hard to understand
Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: 3b443abec254cb8214881e11af4c09e923cd2dd1
Component: engine
2015-09-22 09:34:49 +08: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
7a04c92cc8 Merge pull request #16437 from runcom/invalid-logger-address
daemon: logger: error out on daemon start if invalid logger address
Upstream-commit: d572bab4a09eb7d60961867d2d2f9896595a3271
Component: engine
2015-09-21 14:53:47 -04:00
651f1e747f Organize server pre-func logic in middlewares.
It defines global middlewares for every request.
This makes the server slightly more composable.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 0fea04d27ee91d7b57e0a77b110db1c861768c74
Component: engine
2015-09-21 14:27:06 -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
7020653250 api: server: container: fix wrong comment
This comment was wrongly referring to the old job mechanism and it
wasn't clear what it was trying to document.

Signed-off-by: Antonio Murdaca <runcom@linux.com>
Upstream-commit: 76b3b5431475709b27f0c113f9319321388a49d1
Component: engine
2015-09-21 00:46:16 +02: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
a5c36fcdf5 Merge pull request #16389 from HuKeping/stats-zero
Reset data of stats in docker cli when container stopped
Upstream-commit: 41646cb4e318b025a5a5c627481e551c49f726e2
Component: engine
2015-09-18 18:59:51 +02: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
3904dd3167 Move api/errors/ to errors/
Per @calavera's suggestion: https://github.com/docker/docker/pull/16355#issuecomment-141139220

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: a283a30fb026aad4434a9f2e34f7ce955d27a957
Component: engine
2015-09-17 11:54:14 -07:00
2d5e18cda2 Merge pull request #16355 from duglin/DaemonErrors
Convert some "daemon" static error strings to the new errocode package format
Upstream-commit: 828e4ac45a5b4954997949570b9b032c57137849
Component: engine
2015-09-17 11:48:37 -07:00
d13159ba93 Merge pull request #16361 from MHBauer/stats-refactor
refactor stats to not use internal data structures
Upstream-commit: cafee2eb4544442cd1307c1484235261b5b2752a
Component: engine
2015-09-17 08:28:07 -07: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
b23ea59e6d refactor stats to not use internal data structures
- refactor to make it easier to split the api in the future
 - addition to check the existing test case and make sure it contains
   some expected output

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
Upstream-commit: 2d5d606fd368814ead4ff189eeae264f2af8691b
Component: engine
2015-09-16 17:28:52 -07:00
6295202aba Convert some "daemon" static error strings to the new errocode package format
Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: f7d4b4fe2b130a522dee847a657218806180fa52
Component: engine
2015-09-16 16:16:42 -07:00
5e58ae50d3 Merge pull request #15786 from HuKeping/stats-network
Refactor the statistics of network in docker stats
Upstream-commit: 259a0fb16ceac921763172127183059dea7e3c46
Component: engine
2015-09-16 20:29:16 +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
700bfcfe4a Merge pull request #15069 from duglin/UseErrorPackage
Use the new error package
Upstream-commit: e91f2c26ce38787e159162d2c4a43744396e3308
Component: engine
2015-09-15 09:28:53 -04: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
bb8ff26c08 Use the new error package
This is the first step in converting out static strings into well-defined
error types.  This shows just a few examples of it to get a feel for how things
will look. Once we agree on the basic outline we can then work on converting
the rest of the code over.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 628b9a41b09fde3ce1493f7d4f1495b9afaa506c
Component: engine
2015-09-14 13:11:01 -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
c3a694b001 Merge pull request #16215 from HuKeping/save
Refactor CLI docker save
Upstream-commit: bc48194ded4892d277345e45defee66a24f36399
Component: engine
2015-09-11 13:52:59 -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
d563cc164c Signal to stop a container.
Allow to set the signal to stop a container in `docker run`:
- Use `--stop-signal` with docker-run to set the default signal the container will use to exit.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 0e50d946a25beb134bce2aaf4a209b5cfcbacf8f
Component: engine
2015-09-10 19:56:05 -04:00
9f56a7069d Added tags list to /images/:id/json api.
It closes #10139.

Signed-off-by: Rozhnov Alexandr <nox73@ya.ru>
Upstream-commit: e9e68fa2d29a5e3053fb876b19b5ac5bc6d1c222
Component: engine
2015-09-10 11:55:01 +03:00
da795b0534 Merge pull request #15953 from duglin/DaemonContext
Add a "context" to the api/server/* code
Upstream-commit: 6efe45990d7d50940b8c070be7b45b7a7399d327
Component: engine
2015-09-09 17:28:38 -07:00
9ec0a0380f Move context stuff to its own package
Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: f790496d8bd0930d7b1bc4adf120ae5ef169a958
Component: engine
2015-09-09 14:23:25 -07: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
8f5d65caff Add a "context" to the api/server/* code
This defines a 'context' object that is passed to each API handler.
Right now the context just has a unique 'requestID' for each API call.
The next steps would be:
- use this 'requestID' in our logging.
- determine the best way to format the logging to include this info.

In particular for log events that generate multiple entries in the log
we can use the requestID to help correlate the log entries.

Adding the requestID to the logging will be a challenge since it could mean
changing every single logrus.XXX() call to pass in the 'context' object.

But first step is to agree on a format, which we can discus in a subsequent
PR, but my initial thoughts are to add it right after the timestamp:

current format:
INFO[0039] POST /v1.21/build?buildargs=%7B%22foo%22%3A%22xxx%22%7D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&memory=0&memswap=0&rm=1&t=&ulimits=null

proposed format:
INFO[0039-83dea1222191] POST /v1.21/build?buildargs=%7B%22foo%22%3A%22xxx%22%7D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&memory=0&memswap=0&rm=1&t=&ulimits=null

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 8b454dd79e6a11c3c881f8a755423713c0491287
Component: engine
2015-09-09 12:51:20 -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
154c412ece Merge pull request #15798 from calavera/volume_driver_host_config
Move VolumeDriver to HostConfig to make containers portable.
Upstream-commit: 9ca4aa479788867cd2dce161efa1e43ea5dfc14f
Component: engine
2015-09-08 22:05:40 -04: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
6d655f6a79 Merge pull request #16130 from aboch/vnd
Vendoring libnetwork 3e31cead05cba8ec20241630d051e6d73765b3a2
Upstream-commit: eb5c81e79980dd7fad211724adb27e42a3295a6c
Component: engine
2015-09-08 11:29:34 -07:00
8b42f11b4c Merge pull request #16142 from cpuguy83/stats_pass_container
Don't lookup container 4 times for stats
Upstream-commit: 451f4d0d3b5708108807429d6795248871b175a8
Component: engine
2015-09-08 11:19:33 -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
51f6d2a64b Vendoring libnetwork 3e31cead05cba8ec20241630d051e6d73765b3a2
+ Fix a couple of bugs introduced by previous vendoring:
  - in bitseq which prevents to use experimental overlay networking
  - in docker service ls cli o/p
+ Add missing http subrouter for newly introduced sandboxes
+ Fix fragmentation issue on vxlan header addition for overlay network driver
+ Remove libnetwork test code utilities from vendoring

Signed-off-by: Alessandro Boch <aboch@docker.com>
Upstream-commit: 4d648f924af93b6429d566120a65cb441fee692a
Component: engine
2015-09-08 07:36:35 -07:00
4a380ba714 Don't lookup container 4 times for stats
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: dc8a39036b8c9da4c21c48f492cdbb795170bb21
Component: engine
2015-09-08 10:12:46 -04:00