Commit graph

1142 commits

Author SHA1 Message Date
Sally O'Malley
e41753678d docker restarts running OR stopped containers, docs edit rm "running"
Signed-off-by: Sally O'Malley <somalley@redhat.com>
2015-09-20 09:16:27 -04:00
Antonio Murdaca
41646cb4e3 Merge pull request #16389 from HuKeping/stats-zero
Reset data of stats in docker cli when container stopped
2015-09-18 18:59:51 +02:00
Hu Keping
da67833e63 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>
2015-09-18 15:24:13 +08:00
Doug Davis
a283a30fb0 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>
2015-09-17 11:54:14 -07:00
Jess Frazelle
828e4ac45a Merge pull request #16355 from duglin/DaemonErrors
Convert some "daemon" static error strings to the new errocode package format
2015-09-17 11:48:37 -07:00
David Calavera
cafee2eb45 Merge pull request #16361 from MHBauer/stats-refactor
refactor stats to not use internal data structures
2015-09-17 08:28:07 -07:00
Antonio Murdaca
ffaee8fe78 Merge pull request #16336 from mountkin/fix-hijack
error should be checked earlier in the hijack function
2015-09-17 09:38:48 +02:00
Morgan Bauer
2d5d606fd3
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>
2015-09-16 17:28:52 -07:00
Doug Davis
f7d4b4fe2b Convert some "daemon" static error strings to the new errocode package format
Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-09-16 16:16:42 -07:00
Sebastiaan van Stijn
259a0fb16c Merge pull request #15786 from HuKeping/stats-network
Refactor the statistics of network in docker stats
2015-09-16 20:29:16 +02:00
Shijiang Wei
f2d978ccf9 error should be checked earlier in the hijack function
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2015-09-16 20:28:07 +08:00
Madhav Puri
54240f8da9 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>
2015-09-16 03:31:15 -07:00
Brian Goff
e91f2c26ce Merge pull request #15069 from duglin/UseErrorPackage
Use the new error package
2015-09-15 09:28:53 -04:00
Hu Keping
d3379946ec 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>
2015-09-15 15:40:34 +08:00
David Calavera
7ce270d4ea Merge pull request #15931 from vdemeester/api-client-ps-coverage
Add more unit tests on api/client/ps package
2015-09-14 14:02:49 -07:00
Doug Davis
628b9a41b0 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>
2015-09-14 13:11:01 -07:00
Nalin Dahyabhai
e611a189cb 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)
2015-09-11 16:50:03 -04:00
Brian Goff
bc48194ded Merge pull request #16215 from HuKeping/save
Refactor CLI docker save
2015-09-11 13:52:59 -04:00
Hu Keping
22be1e443f Refactor CLI docker save
Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-09-11 15:31:55 +08:00
David Calavera
0e50d946a2 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>
2015-09-10 19:56:05 -04:00
Rozhnov Alexandr
e9e68fa2d2 Added tags list to /images/:id/json api.
It closes #10139.

Signed-off-by: Rozhnov Alexandr <nox73@ya.ru>
2015-09-10 11:55:01 +03:00
David Calavera
6efe45990d Merge pull request #15953 from duglin/DaemonContext
Add a "context" to the api/server/* code
2015-09-09 17:28:38 -07:00
Doug Davis
f790496d8b Move context stuff to its own package
Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-09-09 14:23:25 -07:00
David Calavera
a796ac5318 Merge pull request #14626 from kunalkushwaha/add-network-cli-help
"docker network" missing from docker --help
2015-09-09 13:36:43 -07:00
Doug Davis
8b454dd79e 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>
2015-09-09 12:51:20 -07:00
Hu Keping
e9602f3561 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>
2015-09-09 19:37:33 +08:00
Brian Goff
9ca4aa4797 Merge pull request #15798 from calavera/volume_driver_host_config
Move VolumeDriver to HostConfig to make containers portable.
2015-09-08 22:05:40 -04:00
Doug Davis
87255b6721 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>
2015-09-08 14:24:00 -07:00
Madhu Venugopal
eb5c81e799 Merge pull request #16130 from aboch/vnd
Vendoring libnetwork 3e31cead05cba8ec20241630d051e6d73765b3a2
2015-09-08 11:29:34 -07:00
Jess Frazelle
451f4d0d3b Merge pull request #16142 from cpuguy83/stats_pass_container
Don't lookup container 4 times for stats
2015-09-08 11:19:33 -07:00
Harald Albers
00eaa7e1f5 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>
2015-09-08 09:14:57 -07:00
Alessandro Boch
4d648f924a 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>
2015-09-08 07:36:35 -07:00
Brian Goff
dc8a39036b Don't lookup container 4 times for stats
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-09-08 10:12:46 -04:00
Brian Goff
5f5d73d515 Merge pull request #14488 from HuKeping/fixstats
Fix connection block when using docker stats API
2015-09-08 10:01:11 -04:00
David Calavera
719886d435 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>
2015-09-07 19:29:33 -04:00
Vincent Demeester
6baf65d1a6 Complete unit tests on api/client/ps package
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-09-06 22:05:57 +02:00
Hu Keping
d9bf8163ad 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>
2015-09-06 17:21:41 +08:00
David Calavera
6549d6517b Move VolumeDriver to HostConfig to make containers portable.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-09-04 12:42:44 -04:00
Kunal Kushwaha
44da5c3de2 "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>
2015-09-04 15:34:17 +09:00
angt
01059cba78 Fix typo
Signed-off-by: Adrien Gallouët <agallouet@gmail.com>
2015-09-02 10:43:49 +02:00
David Calavera
2093616d7f Merge pull request #15871 from Microsoft/10662-absolute
Windows: Fix absolute checks
2015-09-01 18:38:36 +02:00
John Howard
49c1b51ae2 Windows: Fix absolute checks
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-09-01 08:41:37 -07:00
David Calavera
b5cc077864 Remove /containers/ps from the api router.
This route was deprecated more than two years ago in the linked
commit[1]. It's not referenced anywhere in the documentation and it's
time to stop maintaning it.

[1]: 4f9443927e

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-09-01 05:17:35 -04:00
David Calavera
96974170f8 Merge pull request #15606 from jlhawn/img_delete
[daemon] Refactor image_delete.go
2015-08-31 18:22:48 +02:00
David Calavera
754d81bd69 Merge pull request #15873 from cpuguy83/no_args_for_volume_subcmd
Fix `docker volume invalidarg` so it displays usage
2015-08-31 10:04:45 +02:00
Josh Hawn
111d2f3487 [daemon] Refactor image_delete.go
This file was not well documented and had very high cyclomatic complexity.
This patch completely rearranges this file and the ImageDelete method to
be easier to follow and more maintainable in the future.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2015-08-28 11:01:24 -07:00
David Calavera
433956cc47 Merge pull request #15310 from MHBauer/demon-lint-squash
golint fixes for daemon/ package
2015-08-28 17:34:36 +02:00
Alexander Morozov
6caaa8a635 Merge pull request #15023 from hqhq/hq_add_status_in_inspect
Add status string to State field for inspect
2015-08-28 08:27:36 -07:00
Morgan Bauer
abd72d4008
golint fixes for daemon/ package
- some method names were changed to have a 'Locking' suffix, as the
 downcased versions already existed, and the existing functions simply
 had locks around the already downcased version.
 - deleting unused functions
 - package comment
 - magic numbers replaced by golang constants
 - comments all over

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
2015-08-27 22:07:42 -07:00
Brian Goff
38da43184d Fix docker volume invalid so it displays usage
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-08-27 09:46:05 -04:00