Commit Graph

849 Commits

Author SHA1 Message Date
Simon Ferquel b34f340346 Introduce docker context store
This PR adds a store to the CLI, that can be leveraged to persist and
retrieve credentials for various API endpoints, as well as
context-specific settings (initially, default stack orchestrator, but we
could expand that).

This comes with the logic to persist and retrieve endpoints configs
for both Docker and Kubernetes APIs.

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2019-01-04 17:06:51 +01:00
Silvin Lubecki adf71a41b2
Merge pull request #1583 from jdrouet/compose-on-kube-sync
replace implementation by compose-on-kubernetes
2018-12-28 18:17:38 +01:00
Jérémie Drouet a6b0d1d174 replace the imports in the cli to use compose-on-kubernetes
Signed-off-by: Jérémie Drouet <jeremie.drouet@gmail.com>
2018-12-28 15:49:20 +01:00
Vincent Demeester dd3407b6cc
Add option to pull images quietly
Add `--quiet` to the `docker image pull` subcommand that will not pull
the image quietly.

```
$ docker pull -q golang
Using default tag: latest
```

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-12-19 13:48:41 +01:00
Sebastiaan van Stijn 579bb91853
Fix panic (npe) when updating service limits/reservations
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-13 02:21:57 +01:00
Tibor Vass b991b6236a prune: use filters.Args.Clone()
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-12-10 16:48:59 +00:00
Sebastiaan van Stijn 1e1dd5bca4
Fix panic when pruning images with label-filter
Before this change:

    docker image prune --force --filter "label=foobar"
    panic: assignment to entry in nil map

    goroutine 1 [running]:
    github.com/docker/cli/vendor/github.com/docker/docker/api/types/filters.Args.Add(...)
    /go/src/github.com/docker/cli/vendor/github.com/docker/docker/api/types/filters/parse.go:167
    github.com/docker/cli/cli/command/image.runPrune(0x1db3a20, 0xc000344cf0, 0x16e0001, 0xc00015e600, 0x4, 0x3, 0xc00024e160, 0xc000545c70, 0x5ab4b5)
    /go/src/github.com/docker/cli/cli/command/image/prune.go:79 +0xbaf
    github.com/docker/cli/cli/command/image.NewPruneCommand.func1(0xc00029ef00, 0xc0004a8180, 0x0, 0x3, 0x0, 0x0)
    /go/src/github.com/docker/cli/cli/command/image/prune.go:32 +0x64
    github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).execute(0xc00029ef00, 0xc000038210, 0x3, 0x3, 0xc00029ef00, 0xc000038210)
    /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:762 +0x473
    github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc000127180, 0xc000272770, 0x1836ce0, 0xc000272780)
    /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:852 +0x2fd
    github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).Execute(0xc000127180, 0xc000127180, 0x1d60880)
    /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:800 +0x2b
    main.main()
    /go/src/github.com/docker/cli/cmd/docker/docker.go:180 +0xdc

With this patch applied:

    docker image prune --force --filter "label=foobar"
    Total reclaimed space: 0B

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-07 17:56:31 +01:00
Aleksa Sarai 647579068f
cli: add a separate --domainname flag
A while ago, Docker split the "Domainname" field out from the "Hostname"
field for the container configuration. There was no real user-visible
change associated with this (and under the hood "Domainname" was mostly
left unused from the command-line point of view). We now add this flag
in order to match other proposed changes to allow for setting the NIS
domainname of a container.

This also includes a fix for the --hostname parsing tests (they would
not error out if only one of .Hostname and .Domainname were incorrectly
set -- which is not correct).

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2018-12-08 00:03:56 +11:00
Sebastiaan van Stijn 1f6a1a438c
Merge pull request #1252 from albers/completion-cli-experimental
Add bash completion for experimental CLI commands (manifest)
2018-11-29 17:11:28 +01:00
Silvin Lubecki 69bd2728c4
Merge pull request #1509 from selansen/master
Data Path Port configuration support
2018-11-28 17:10:39 +01:00
selansen e3e976a82a Data Path Port configuration support
This PR chnages allow user to configure data path
port number. By default we use 4789 port number. But this commit
will allow user to configure port number during swarm init.
Data path port can't be modified after swarm init.

Signed-off-by: selansen <elango.siva@docker.com>
2018-11-28 10:55:42 -05:00
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 29625f6124
Merge pull request #1415 from dhiltgen/fix_panic_master
Fix panic in display only case for license - forward port #1408 to master
2018-11-15 00:55:48 +01:00
Simon Ferquel 8efa6a9567 Fix tests with missing mocks
A recent change in moby/moby made tests with missing client mocks fail with panic.
This adds those missing mocks for the impacted tests.

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2018-11-08 11:37:49 +01:00
Silvin Lubecki 6b71e84ec8
Merge pull request #1472 from lifubang/sshlogs
Enhancement: don't need to type ssh password twice when docker logs with ssh
2018-10-26 15:41:39 +01:00
Silvin Lubecki 0904fbfc77
Merge pull request #1369 from vdemeester/formatter-refacto
formatter package heavy refactoring
2018-10-26 10:43:13 +01:00
Lifubang aba8821f60 don't need to type ssh password twice when docker logs with ssh
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-10-26 08:22:49 +08: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
Vincent Demeester 69fdd2a4ad
formatter package heavy refactoring
- make it possible to extract the formatter implementation from the
  "common" code, that way, the formatter package stays small
- extract some formatter into their own packages

This is essentially moving the "formatter" implementation of each type
in their respective packages. The *main* reason to do that, is to be
able to depend on `cli/command/formatter` without depending of the
implementation detail of the formatter. As of now, depending on
`cli/command/formatter` means we depend on `docker/docker/api/types`,
`docker/licensing`, … — that should not be the case. `formatter`
should hold the common code (or helpers) to easily create formatter,
not all formatter implementations.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-10-23 17:05:44 +02:00
Tibor Vass 3e8c41beb0 build: update session support detection
Avoid testing for session support in non-buildkit builder to support
servers that falsely report as `1.39` compatible

Signed-off-by: Tibor Vass <tibor@docker.com>
2018-10-22 20:52:56 +00:00
Sebastiaan van Stijn 2e385015f7
Merge pull request #1451 from tiborvass/builder-prune-filter-unused-for
builder/prune: rename max-age filter to unused-for in help output
2018-10-17 17:55:44 +02:00
Brian Goff a2a7a7cc00
Merge pull request #1443 from acmcodercom/defaulttcpschema
fixes #1441 set default schema to tcp for docker host
2018-10-16 20:58:11 -07:00
Tibor Vass c9ce6dc656 builder/prune: rename max-age filter to unused-for in help output
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-10-17 00:35:10 +00:00
Lifubang beed8748c0 add test case TestNewAPIClientFromFlagsForDefaultSchema
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-10-16 15:34:54 +08:00
Lifubang 2431dd1448 set default schema to tcp for docker host
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-10-16 10:32:03 +08:00
Lifubang 99f336a580 err message improve when ssh fail
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-10-15 16:42:14 +08:00
Sebastiaan van Stijn b9a1a21fe2
Merge pull request #1426 from kolyshkin/go111-pr1316
Bump Go to 1.11.1
2018-10-11 20:19:20 +02:00
Kir Kolyshkin 906c2d161a gofmt with go-1.11
gofmt/goimports changed some heuristics in 1.11 and the code is now
formatted slightly differently.

No functional change, just whitespace.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-10-11 01:54:38 -07:00
Kir Kolyshkin 51848bf3bb cli/registry: fix a Debugf statement
Fix this warning from go-1.11

> cli/registry/client/fetcher.go:234: Debugf format %s has arg
> repoEndpoint of wrong type client.repositoryEndpoint

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-10-11 01:13:13 -07:00
Tibor Vass bbd01fe3df build: only show buildkit-specific flags if buildkit is enabled
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-10-10 21:09:22 +00:00
Tibor Vass ab50c2f2b2
Merge pull request #1419 from AkihiroSuda/dfssh
build: add SSH agent socket forwarder (`docker build --ssh $SSHMOUNTID=$SSH_AUTH_SOCK`)
2018-10-09 13:43:27 -07:00
Li Yi 814ced4b30 Using strings.Builder instead of string appending
Signed-off-by: Li Yi <denverdino@gmail.com>
2018-10-09 10:38:21 +08:00
Akihiro Suda db7399a016 build: add SSH agent socket forwarder (`docker build --ssh $SSHMOUNTID=$SSH_AUTH_SOCK`)
Unlike `docker build --secret`, `docker build --ssh` allows the build container to
use SSH keys with passphrases.

  $ eval $(ssh-agent)
  $ ssh-add ~/.ssh/id_rsa
  (Input your passphrase here)
  $ docker build --ssh default=$SSH_AUTH_SOCK ...

This feature requires the daemon with `CapExecMountSSH` build capability (moby/moby#37973) .

Currently, the official Dockerfile frontend does not provide the syntax for using the SSH forwarder.

However, the experimental `RUN --mount=type=ssh` syntax can be enabled by using
the Dockerfile frontend image built with the `BUILDTAGS="dfrunmount dfssh"`, via the `# syntax =` "shebang".

The Dockerfile for the Dockerfile frontend is available at  github.com/moby/buildkit/frontend/dockerfile/cmd/dockerfile-frontend)
The pre-built image is also available as `tonistiigi/dockerfile:ssh20181002` .

An example Dockerfile with `RUN --mount=type=ssh`:

  # syntax = tonistiigi/dockerfile:ssh20181002
  FROM alpine
  RUN apk add --no-cache openssh-client
  RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
  RUN --mount=type=ssh ssh git@gitlab.com | tee /hello
  # "Welcome to GitLab, @GITLAB_USERNAME_ASSOCIATED_WITH_SSHKEY" should be printed here

More info available at moby/buildkit#608, moby/buildkit#655

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-10-05 19:56:32 +09:00
Akihiro Suda 846c38cbd7 bump up buildkit
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-10-05 18:14:03 +09:00
Daniel Hiltgen 864aef7d20 Add test coverage for display only with hub licenses
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
(cherry picked from commit 92932647d3)
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
2018-10-03 13:48:33 -07:00
Daniel Hiltgen 53f053ee6f Fix panic in display only case for license
Prior refactoring passes missed a corner case.

Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
(cherry picked from commit dee37936e5)
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
2018-10-03 13:48:29 -07:00
Sebastiaan van Stijn 608b6632b0
Merge pull request #1407 from mindaugasrukas/transform
Allow to transform any source type into the target struct
2018-10-03 10:06:32 +02:00
Daniel Hiltgen a4aba23b85
Remove unused helath check func
During the refactoring for 18.09 the activate/update flows no longer
restart the engine explicitly but let the user do that when they're ready,
so the health check logic is no longer required.

Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
(cherry picked from commit f2b2061cc3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-02 20:52:34 +02:00
Mindaugas Rukas 83fd688fa2 Allow to transform any source type into the target struct
Signed-off-by: Mindaugas Rukas <momomg@gmail.com>
2018-10-02 16:06:08 +03:00
Daniel Hiltgen 4a888d3031 Refine how metadata dir is handled
This is a follow up PR to #1381 to address some of the review comments
we didn't get to.

Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
(cherry picked from commit c12e23a4c1)
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
2018-10-01 14:28:11 -07:00
Andrew Hsu d7ae94b885 use gotest.tools/fs for TestActivateExpiredLicenseDryRun
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
(cherry picked from commit a7488d1bcd)
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
2018-09-28 14:50:52 -07:00
Daniel Hiltgen d486baebfc Expose licensing details before loading
Help the user understand which license they're about
to load in case they have multiple licenses they need to
figure out.

Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
(cherry picked from commit 5a97a93ae1)
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
2018-09-28 14:37:02 -07:00
Tõnis Tiigi 00c0c7e12f
Merge pull request #1345 from AkihiroSuda/fix-kill-warning
connhelper: try sending SIGTERM before SIGKILL
2018-09-28 08:22:13 -07:00
Sebastiaan van Stijn 3e4e232e0d
Merge pull request #1195 from olljanat/34795-npipe-mount-type
Allow npipe volume type on stack file
2018-09-28 10:57:09 +02:00
Olli Janatuinen 0704d9a031 Allow npipe volume type on stack file
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2018-09-27 18:47:20 +03:00
Silvin Lubecki 7d313cf865
Merge pull request #1385 from dhiltgen/revamp_master
Forward port #1381 to master
2018-09-26 15:29:33 +02:00
Sebastiaan van Stijn ec3daea021
Fix substitution with non-empty env-var
Due to a typo, substitution would not work if the given
environment-variable was set.

Given the following docker compose file;

```yaml
version: "3.7"

services:
  app:
    image: nginx:${version:-latest}
```

Deploying a stack with `$version` set would ignore the `$version`
environment variable, and use the default value instead;

```bash
version=alpine docker stack deploy -c docker-compose.yml foobar

Creating network foobar_default
Creating service foobar_app

docker service ls

ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
rskkjxe6sm0w        foobar_app          replicated          1/1                 nginx:latest
```

This patch also fixes "soft default" not detecting empty environment variables,
only non-set environment variables.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-09-25 22:20:25 +02:00
Daniel Hiltgen 2f23c97d17 Fix lint glitches
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
(cherry picked from commit 6004d74b1f)
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
2018-09-21 15:43:28 -07:00
Daniel Hiltgen b7ec4a42d9 Review comments
Address code review comemnts and purge additional dead code.

Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
(cherry picked from commit f250152bf4)
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
2018-09-21 15:43:00 -07:00
Daniel Hiltgen f07f51f4c8 Refined engine implementations
Adapt the CLI to the host install model for 18.09.

Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
(cherry picked from commit 342afe44fb)
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
2018-09-21 15:41:25 -07:00