Commit Graph

183 Commits

Author SHA1 Message Date
Tibor Vass 6c10abb247 prune: move image pruning before build cache pruning
This is cleaner because running system prune twice in a row
now results in a no-op the second time.

Signed-off-by: Tibor Vass <tibor@docker.com>
2018-11-21 05:33:36 +00:00
Sebastiaan van Stijn 79455f8238
Merge pull request #1325 from dhiltgen/product_license_master
Expose product license in info output
2018-10-26 00:31:32 +02:00
Tibor Vass a90b99edfc system/df: allow -v with --format
This allows to provide more information for build cache disk usage.

Signed-off-by: Tibor Vass <tibor@docker.com>
2018-09-13 23:14:58 +00:00
Tibor Vass ca608c2302 system df: show table output for build cache
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-09-05 03:31:40 +00:00
Tibor Vass c806eb49c9 build: add options to builder prune
This patch adds --filter, --keep-storage, --all and --force to builder prune.

Signed-off-by: Tibor Vass <tibor@docker.com>
2018-09-05 00:01:16 +00:00
Daniel Hiltgen 60551c477d Expose product license in info output
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
(cherry picked from commit 68be7cb376)
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
2018-08-29 07:42:32 -07:00
Sebastiaan van Stijn 3c27ce21c9
Use warnings provided by daemon
Warnings are now generated by the daemon, and returned as
part of the /info API response.

If warnings are returned by the daemon; use those instead
of generating them locally.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-08-21 22:29:57 +02:00
selansen 587a94c935 Global Default Address Pool feature support
This feature brings new attribute/option for swarm init command.
default-addr-pool will take string input which can be in below format.
"CIDR,CIDR,CIDR...:SUBNET-SIZE".
Signed-off-by: selansen <elango.siva@docker.com>
2018-08-21 14:34:00 -04:00
Akihiro Suda 6f61cf053a support SSH connection
e.g. docker -H ssh://me@server

The `docker` CLI also needs to be installed on the remote host to
provide `docker system dial-stdio`, which proxies the daemon socket to stdio.

Please refer to docs/reference/commandline/dockerd.md .

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-08-02 13:10:06 +09:00
Vincent Demeester 55edeb497a
Migrate to non-deprecated functions of `api/types/filters`
- Use `Contains` instead of `Include`
- Use `ToJSON` instead of `ToParam`
- Remove usage of `ParseFlag` as it is deprecated too

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-07-27 15:37:43 +02:00
Sebastiaan van Stijn 0f7ae34ea9
Adapt min-column width to component information
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-12 01:34:34 +02:00
Sebastiaan van Stijn 55ff66d967
Extend version-align test with components
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-12 01:31:23 +02:00
Silvin Lubecki e8c87f7cb3
Warn if DOCKER_ORCHESTRATOR is still used but not DOCKER_STACK_ORCHESTRATOR
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-22 13:58:39 -07:00
Sebastiaan van Stijn f0a8598b8d
Remove shorthand `-k` option from `docker version`
The `-k` shorthand was alreaady removed from other
commands, so best to be consistent.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-21 23:33:55 -07:00
Sebastiaan van Stijn a63252ba71
Remove "Stack Orchestrator" from "docker version"
The output of this information can be confusing,
so removing until we have a better design for this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-21 22:02:11 -07:00
Silvin Lubecki 71272dd203
Scope orchestration selection to stack commands only
* Renaming DOCKER_ORCHESTRATOR to DOCKER_STACK_ORCHESTRATOR
* Renaming config file option "orchestrator" to "stackOrchestrator"
* "--orchestrator" flag is no more global but local to stack command and subcommands
* Cleaning all global orchestrator code
* Replicating Hidden flags in help and Supported flags from root command to stack command

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2018-06-21 17:12:31 -07:00
Vincent Demeester 88068b9dd7
Use command.Cli interface instead of concrete type…
… wherever it's possible. Should make it even easier to test and use
another implementation.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-14 16:26:47 +02:00
Andrew Hsu 2daec78609
Merge pull request #1111 from tiborvass/experimental-buildkit
Support for experimental BuildKit
2018-06-13 18:21:41 -07:00
Tonis Tiigi b19294ee42 system: add buildcache formatting
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-09 20:51:34 +00:00
Vincent Demeester 2c4de4fb5e
Update tests to use gotest.tools 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-08 18:24:26 +02:00
Sebastiaan van Stijn bb71808605
Add test for version output aligning
Includes some refactoring to allow testing the output
in isolation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-05-31 10:15:15 +02:00
Silvin Lubecki f2b75a879a Remove experimentalCli annotation from all kubernetes flags and commands
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2018-05-28 15:06:31 +02:00
Sebastiaan van Stijn 680c5790d5
Merge pull request #1043 from justyntemme/patch-2
Fix issue #850, Warn user of filter when pruning
2018-05-22 00:26:26 +02:00
Anda Xu d2090430a6 fix error message from docker inspect
Signed-off-by: Anda Xu <anda.xu@docker.com>
2018-05-21 11:32:16 -07:00
Sebastiaan van Stijn 26d8122594
Fix component information alignment
The `docker version` output now uses a tabwriter, so use single
tabs to print the output.

Before this change:

    Server:
     Engine:
      Version:      18.05.0-ce
      API version:  1.37 (minimum version 1.12)
      Go version:   go1.10.1
      Git commit:   f150324
      Built:        Wed May  9 22:20:16 2018
      OS/Arch:      linux/amd64
      Experimental: true
     Kubernetes:
      Version:     v1.9.6
      StackAPI:                   v1beta2

After this change:

    Server:
     Engine:
      Version:      18.05.0-ce
      API version:  1.37 (minimum version 1.12)
      Go version:   go1.10.1
      Git commit:   f150324
      Built:        Wed May  9 22:20:16 2018
      OS/Arch:      linux/amd64
      Experimental: true
     Kubernetes:
      Version:     v1.9.6
      StackAPI:    v1beta2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-05-18 14:46:23 +02:00
Mathieu Champlon 4d947de292 Support 'all' in orchestrator flag for docker stack ls
All other docker stack commands report an error when passed this value.

Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2018-05-15 15:38:41 +02:00
Brian Goff fd060d2f33
Merge pull request #1038 from kolyshkin/context
Switch from x/net/context to context
2018-05-11 22:13:52 -04:00
Kir Kolyshkin 6f8070deb2 Switch from x/net/context to context
Since go 1.7, "context" is a standard package. Since go 1.9,
x/net/context merely provides some types aliased to those in
the standard context package.

The changes were performed by the following script:

for f in $(git ls-files \*.go | grep -v ^vendor/); do
	sed -i 's|golang.org/x/net/context|context|' $f
	goimports -w $f
	for i in 1 2; do
		awk '/^$/ {e=1; next;}
			/\t"context"$/ {e=0;}
			{if (e) {print ""; e=0}; print;}' < $f > $f.new && \
				mv $f.new $f
		goimports -w $f
	done
done

[v2: do awk/goimports fixup twice]
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-05-11 16:49:43 -07:00
Silvin Lubecki f0aa126b03 Fix using the namespace specified in the kubeconfig file.
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2018-05-09 17:30:36 +02:00
Justyn Temme 7d113de085 Update prune.go
Append a warning with which filter the elements will be pruned with if filter is set.

Signed-off-by: Justyn Temme <justyntemme@gmail.com>
2018-05-08 09:08:26 -05:00
Vincent Demeester 740d260cd2
Remove more TODOs
- Some of them don't make sense anymore
- Some are deprecated and removed from the engine since a few versions
  already.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-04-23 14:57:29 +02:00
Vincent Demeester eb4a4fe9b9
Merge pull request #965 from thaJeztah/fix-version-output
Fix docker version output alignment
2018-03-28 09:53:34 +02:00
Sebastiaan van Stijn 48eb7a082d
Fix docker version output alignment
Use tabwriter to print the version output

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-03-26 17:59:20 +02:00
Silvin Lubecki 54bb5ffeca Fix Kubernetes duplication in version command when the server already exposes one Kubernetes component
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2018-03-23 15:52:25 +01:00
Daniel Nephin 078cbc9c4b Convert assert.Check with
git grep -l -P '^\s+assert\.Check\(t, ' | \
    xargs perl -pi -e 's/^(\s+assert)\.Check(\(t, (?!is).*(\.Execute\(|\.Set\(|\.Write\(|\.Close\(|\.Untar\(|\.WriteFile\(|Validate\().*\)$)/\1.NilError\2/'

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-06 15:43:53 -05:00
Daniel Nephin 5155cda716 Post migration fixes
Fix tests that failed when using cmp.Compare()
internal/test/testutil/assert
InDelta
Fix DeepEqual with kube metav1.Time
Convert some ErrorContains to assert

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-05 19:41:17 -05:00
Daniel Nephin 39c2ca57c1 Automated migration
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-05 19:41:17 -05:00
Daniel Nephin 93615dd967 Update some assertions.
and fix some tests

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-05 17:15:24 -05:00
Silvin Lubecki 854aad8927 Print Stack API version in version command
* Resolve Stack API using Kubernetes discovering API
* Refactor Kubernetes flags parsing

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2018-02-26 01:16:49 +01:00
Silvin Lubecki ad409767bf Activate kubernetes only when experimental cli is enabled
* Refactor tests on version and kubernetes switch
* Fix rebase errors
* Refactor for gocyclo linter

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2017-12-28 14:40:10 +01:00
Vincent Demeester 5d375b348a Set a global orchestrator flag
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-12-28 14:40:10 +01:00
Silvin Lubecki ba5d0d8ff5 Move e2e test on version command to unit tests
* Refactor a little version command

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2017-12-26 11:46:59 +01:00
Vincent Demeester dedd0db51a Refactor stack command
- Define command and subcommands only once
- Use annotations for k8s or swarm specific flags or subcommands

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-12-26 11:45:56 +01:00
Vincent Demeester 0508c09494 Move cli/command/orchestrator to cli/command
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-12-26 11:25:22 +01:00
Vincent Demeester 8417e49792 Add support for kubernetes in docker cli
- Add support for kubernetes for docker stack command
- Update to go 1.9
- Add kubernetes to vendors
- Print orchestrator in docker version command

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2017-12-26 11:22:32 +01:00
Vincent Demeester 84fe1a1b5b
Add support for experimental Cli configuration
Allow to mark some commands and flags experimental on cli (i.e. not
depending to the state of the daemon). This will allow more flexibility
on experimentation with the cli.

Marking `docker trust` as cli experimental as it is documented so.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-12-22 14:48:47 +01:00
Brian Goff 7138d6e301 Sort component details in template
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-12-07 02:04:10 +01:00
Tibor Vass 5f4c5f8bb6 Add platform and its components to docker version output
The Server section of version output is now composed of an Engine
component and potentially more, based on what the /version endpoint
returns.

Signed-off-by: Tibor Vass <tibor@docker.com>
2017-12-07 02:04:10 +01:00
Daniel Nephin c0d004f7cf Update gometalinter
and enable the new WarnUnmatchedDirective to warn if a nolint is unnecessary.
remove some unnecessary nolint

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-10-26 12:21:02 -04:00
Daniel Nephin 4205416c9b Update code for upstream cobra
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-10-25 14:49:26 -04:00
Daniel Nephin 32612058cb Use a local constant
This constant is going to be removed from jsonlog package.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-22 17:59:46 -04:00
Sebastiaan van Stijn 6f1b510843
Refactor/cleanup of docker info
Some mild refactoring of the docker info command;

- Use `fmt.Fprinln()` instead of `fmt.Fprintf()` where possible
- Rename `fprintfIfNotEmpty()` to `fprintlnNonEmpty()`, and removed
  return variables, because they were not used. `fprintlnNonEmpty()`
  now uses fmt.Fprintln()` instead of `fmt.Fprintf()`, because
  formatting was not used.
- Use `fprintlnNonEmpty()` to get rid of some `if` statements
- Extract printing Swarm-related information to a `printSwarmInfo()` function
- Change `Http Proxy` and `Https Proxy` to `HTTP Proxy` / `HTTPS Proxy`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-09-11 15:13:06 +02:00
Ying Li 3428b78e96 Include whether the managers in the swarm are autolocked as part of `docker info`.
Signed-off-by: Ying Li <ying.li@docker.com>
2017-08-25 16:33:46 -07:00
Daniel Nephin b3f843afe2 Move internal/test package out of cli.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-22 10:14:25 -04:00
Vincent Demeester a6800f95fa
Import `docker/docker/pkg/templates` to cli
This package will be deprecated/removed from `docker/docker/pkg` and
is mainly used for the cli format options. Let's import it and
maintain here.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-08-08 17:26:24 +02:00
Sebastiaan van Stijn 3c095dc546
Error if "until" filter is combined with "--volumes" on system prune
The "until" filter is supported by all object types, except for
volumes.

Before this patch, the "until" filter would attempted to be used for the volume
prune endpoint, resulting in an error being returned by the daemon, and
further prune endpoints (networks, images) to be skipped.

    $ docker system prune --filter until=24h --filter label=label.foo=bar

    WARNING! This will remove:
            - all stopped containers
            - all volumes not used by at least one container
            - all networks not used by at least one container
            - all dangling images
    Are you sure you want to continue? [y/N] y
    Error response from daemon: Invalid filter 'until'

    Calling POST /v1.30/containers/prune?filters=%7B%22label%22%3A%7B%22label.foo%3D%3Dbar%22%3Atrue%7D%2C%22until%22%3A%7B%2224h%22%3Atrue%7D%7D
    Calling POST /v1.30/volumes/prune?filters=%7B%22label%22%3A%7B%22label.foo%3D%3Dbar%22%3Atrue%7D%2C%22until%22%3A%7B%2224h%22%3Atrue%7D%7D
    Handler for POST /v1.30/volumes/prune returned error: Invalid filter 'until'
    Error response from daemon: Invalid filter 'until'

With this patch, an error is produced instead, preventing "partial" prune.

    $ docker system prune --filter until=24h --filter label=foo==bar --volumes
    ERROR: The "until" filter is not supported with "--volumes"

Note that `docker volume prune` does not have this problem, and produces an
error if the `until` filter is used;

    $ docker volume prune --filter until=24h

    WARNING! This will remove all volumes not used by at least one container.
    Are you sure you want to continue? [y/N] y
    Error response from daemon: Invalid filter 'until'

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-21 12:11:53 +02:00
Daniel Nephin ff350a04cb Remove unnecessary prune function aliases.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-07-18 12:25:45 -04:00
Vincent Demeester a14762c6d2 Merge pull request #350 from thaJeztah/unexport-commands
Unexport subcommands
2017-07-18 17:17:01 +02:00
Sebastiaan van Stijn 9c7b0d74cd
Unexport subcommands
These commands were only used as subcommands, so did
not have to be exported.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-18 15:26:45 +02:00
Sebastiaan van Stijn 73163ee78b
Small refactor in system prune
Adapt "image prune" and "build cache prune" to have
the same signature as the other prune commands, so
that they can all be added to the "pruneFuncs" array.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-18 15:13:11 +02:00
Kenfe-Mickaël Laventure 19efbc85f4 Merge pull request #345 from vdemeester/remove-prune-package
Remove useless prune package 👼
2017-07-18 14:46:53 +02:00
Vincent Demeester 3f4d91508e
Remove useless prune package 👼
The `cli/command/prune` just does some aliasing of `Prune*` methods,
doesn't have any use.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-07-18 09:49:02 +02:00
Sebastiaan van Stijn 6c3a448ecb
Fix: skip build-cache prune on unsupported versions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-17 11:55:35 +02:00
Harald Albers 849b0e96a0 system prune: only warn about volumes if --volumes is given
Signed-off-by: Harald Albers <github@albersweb.de>
2017-06-29 15:07:21 +02:00
Tonis Tiigi b95638a5ac Use long running session in builder
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>

Add incremental context send support

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-06-26 16:30:01 -07:00
Daniel Nephin 3724fb7f37 Add gosimple lint
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-14 16:55:08 -07:00
Daniel Nephin 3bf0317fea Add unconvert linter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-14 16:54:27 -07:00
Yong Tang 657457ee2c Use `scope=swarm` for service related network inspect.
This fix use `scope=swarm` for service related network inspect.
The purpose is that, in case multiple networks with the same
name exist in different scopes, it is still possible to obtain
the network for services.

This fix is related to moby/moby#33630 and docker/cli#167

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-06-13 20:26:12 +00:00
Brian Goff 37fd6128dc Don't prune volumes on `docker system prune`
Volumes tend to carry important data and pruning them on `docker system
prune` can easily cause unwanted data loss.

Let's play it safe and not prune volumes on `system prune` by default,
and instead provide an option.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-05-30 12:50:30 -04:00
Gaetan de Villele 1cc1f54d90 make system prune “--filter” flag available only for docker 17.04 (api v1.28) and newer
Signed-off-by: Gaetan de Villele <gdevillele@gmail.com>
2017-05-17 12:36:09 -07:00
Ying Li 3fe8321d0c Provide command line tool to view and rotate swarm's currently CA root certificate.
Signed-off-by: Ying Li <ying.li@docker.com>
2017-05-16 14:31:15 -07:00
Vincent Demeester d7f6563efc
Update cli imports to using local package
Also, rename a bunch of variable to not *shadow* the `opts` package
name.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-05-15 14:45:19 +02:00
cyli b75858eb09 Propagate the swarm cluster and node TLS info provided by the REST API
responses to the CLI. In `node ls`, display only whether the nodes' TLS
info matches the cluster's TLS info, or whether the node needs cert rotation.

Signed-off-by: Ying Li <ying.li@docker.com>
2017-05-10 17:49:25 -07:00
Stephen J Day 9a892f1bbc
cli/command/system: remove ioutils dependency
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-05-10 13:38:06 -07:00
Kenfe-Mickael Laventure cf51bde7d9 Display proper version information
- The cli version defaults to "unknown-version" unless set via the VERSION env var
- The commit version can be overridden via GITCOMMIT env var
- The build time can be overridden via BUILDTIME env var

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-05-09 14:22:51 -07:00
Daniel Nephin c31d25653f Add line length linter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-08 15:57:56 -04:00
Daniel Nephin 37ccc00d0e Add interfacer linter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-08 15:57:50 -04:00
Gaetan de Villele 295140edf2 cli: gofmt + goimports
Signed-off-by: Gaetan de Villele <gdevillele@gmail.com>
2017-05-08 10:51:30 -07:00
Tibor Vass 57230a7212 rm client and vendor it instead
Signed-off-by: Tibor Vass <tibor@docker.com>
2017-05-08 10:33:56 -07:00
Brian Goff c44e74e676 Add logdrivers to /info
This is required for swarmkit to be able to filter based on log driver.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-05-03 17:46:39 -07:00
Daniel Nephin 08af0f28c5 Add gocycle lint
Whitelist some existing offenders, and use a high limit for now.
This limit should decrese over time.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-02 17:57:46 -04:00
Daniel Nephin 10641c2aae Update imports.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-04-17 18:07:56 -04:00
Daniel Nephin 1630fc40f8 Import docker/docker/cli
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-04-17 17:40:59 -04:00