Commit Graph

1046 Commits

Author SHA1 Message Date
Simon Ferquel 1cefe057cd Add warnings when DOCKER_HOST conflicts with contexts
For clarity, on `docker context use` or `docker context ls`, this adds a
warning if the DOCKER_HOST variable is set because it overrides the
active context.

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2019-04-10 10:14:47 +02:00
Sebastiaan van Stijn d6af3e143e
Merge pull request #1773 from zappy-shu/create-context-from-current
add --from flag to context create
2019-04-09 16:38:46 +02:00
Mårten Cassel 5bc9f490a9 add cli integration for unconfined systempaths with unit test, implement suggested changes
Signed-off-by: Mårten Cassel <marten.cassel@gmail.com>
2019-04-05 15:46:15 +02:00
Tibor Vass 45ec86b10f vendor github.com/docker/docker to bcaa613d823
Signed-off-by: Tibor Vass <tibor@docker.com>
2019-04-03 20:57:18 +00:00
Sebastiaan van Stijn 70d8e0b867
Add ip and ip6 to advanced network syntax
This allows setting the ip/ipv6 address as an option in the
advanced `--network` syntax;

```
docker run --network name=mynetwork,ip=172.20.88.22,ip6=2001:db8::8822
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-03 17:03:34 +02:00
Silvin Lubecki 39f30ef168
Merge pull request #1767 from thaJeztah/carry_317_network_advanced
[carry 317] Cli change to pass driver specific options to docker run
2019-04-03 17:00:03 +02:00
Sebastiaan van Stijn 7ad850e58d
Merge pull request #1800 from tonistiigi/update-buildkit
vendor: update buildkit to 62e55427
2019-04-03 16:56:05 +02:00
Sebastiaan van Stijn 5bc09639cc
Refactor network parsing, add preliminary support for multiple networks
This refactors the way networking options are parsed, and makes the
client able to pass options for multiple networks. Currently, the
daemon does not yet accept multiple networks when creating a container,
and will produce an error.

For backward-compatibility, the following global networking-related
options are associated with the first network (in case multiple
networks are set);

  - `--ip`
  - `--ip6`
  - `--link`
  - `--link-local-ip`
  - `--network-alias`

Not all of these options are supported yet in the advanced notation,
but for options that are supported, setting both the per-network option
and the global option will produce a "conflicting options" error.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-03 16:42:57 +02:00
Abhinandan Prativadi c4844b1fdd
Cli change to pass driver specific options to docker run
The commit contains cli changes to support driver options for a network in
docker run and docker network connect cli's. The driver-opt, aliases is now
supported in the form of csv as per network option in service commands in
swarm mode since docker/cli#62 . This commit extends this support to docker
run command as well.

For docker connect command `--driver-opt` is added to pass driver specific
options for the network the container is connecting to.

Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-03 16:30:26 +02:00
Tonis Tiigi 198407c56b vendor: update buildkit to 62e55427
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-04-02 23:40:56 -07:00
Nick Adcock 8bb152d967 add --from option to context create
--from creates a context from a named context.
By default `context create` will create a context from the current context.
Replaced "from-current=" docker/kubernetes option with "from=" to allow specifying which context to copy the settings from.

Signed-off-by: Nick Adcock <nick.adcock@docker.com>
2019-04-02 13:41:47 +01:00
Tibor Vass 5bbb56bfee
Merge pull request #1772 from AkihiroSuda/dialstdio-1736
dial-stdio: fix goroutine leakage
2019-04-01 15:17:10 -07:00
Simon Ferquel 8cd74eb33a Fix the stack informer's selector used to track deployment
Old selector was wrong (it watched for the label we applied to child
resources when reconciling the stack, instead of the stack itself)

This should be back-ported to older version of the CLI

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2019-04-01 15:18:55 +02:00
Sebastiaan van Stijn f28d078426
Merge pull request #1577 from orisano/1576-improve-validate-context-directory
feat: improves ValidateContextDirectory performance
2019-04-01 13:22:27 +02:00
Sebastiaan van Stijn aa53429cb7
Merge pull request #1774 from zappy-shu/bump-kubernetes-1-13-4
bump kubernetes to v1.14.0
2019-04-01 11:49:52 +02:00
Sebastiaan van Stijn 2236568053
Merge pull request #1789 from djs55/fix-login-logout
Fix login logout when engine is down and credential helper is in use
2019-03-29 15:39:55 +01:00
Nick Adcock 0b6685bca8 bump kubernetes to v1.14.0
bump required:
- replacing vendor ghodss/yaml with sigs.k8s.io/yaml
- adding vendor k8s.io/klog and github.com/evanphx
- compose-on-kubernetes
removed 'IncludeUninitialized' from watch as it have been removed from k8s

Signed-off-by: Nick Adcock <nick.adcock@docker.com>
2019-03-29 09:20:28 +00:00
David Scott c9d0e47414 Simplify ElectAuthServer
Instead of using an `if else if else`, switch to a sequence of independent
`if` blocks containing a `return`.

Instead of defining a return variable and updating it in the `if` blocks
and returning at the end, make each `if` block return the desired value
independenly.

Signed-off-by: David Scott <dave.scott@docker.com>
2019-03-28 21:08:13 +00:00
David Scott a82e6868cc Use the default registry even without --debug
Previously if the Docker engine was not running the behaviour of
commands would vary depending on whether the --debug flag was provided.

For example, consider `docker logout`:

    $ docker logout
    Not logged in to

-- note the missing server URL

    $ docker --debug logout
    Warning: failed to get default registry endpoint from daemon (Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?). Using system default: https://index.docker.io/v1/
    Not logged in to https://index.docker.io/v1/

-- note the server URL is present

This patch makes only the debug printing conditional on the `--debug` flag,
not the return value.

Signed-off-by: David Scott <dave.scott@docker.com>
2019-03-28 21:04:39 +00:00
Sune Keller 217308d96d
Fix annotation on docker secret create --template-driver
Signed-off-by: Sune Keller <absukl@almbrand.dk>
2019-03-28 16:18:50 +01:00
Nao YONASHIRO 446762dc19 test: add filepathMatches test
Signed-off-by: Nao YONASHIRO <owan.orisano@gmail.com>
2019-03-28 01:22:11 +09:00
Nao YONASHIRO b41ddc6058 feat: improves ValidateContextDirectory performance
Signed-off-by: Nao YONASHIRO <owan.orisano@gmail.com>
2019-03-28 01:20:42 +09:00
Akihiro Suda f8d4c443ba dial-stdio: fix goroutine leakage
Fix #1736

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2019-03-22 20:22:00 +09:00
Lifubang 06e250d37b add test case for DetectArchiveReader
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2019-03-21 15:38:31 -07:00
Kir Kolyshkin 0c20554f69 image build: fix archive detection
As pointed out in #1459, docker cli fails to detect that the input is a tarball,
in case it is generated by `git archive --format=tgz`.

This happens because `git archive` adds some metadata to the initial tar header,
and so it is more than 1 block (of 512 bytes) long, while we only provide 1 block
to archive/tar.Next() and it fails.

To fix, give it 2 blocks :)

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-03-21 15:38:07 -07:00
Tõnis Tiigi dca6d2afa1
Merge pull request #1765 from thaJeztah/carry_181_pids_limit
Add `--pids-limit` flag to `docker update`
2019-03-21 14:11:09 -07:00
Sebastiaan van Stijn 059c085261
Merge pull request #1714 from tiborvass/nvidia-gpu
container: --gpus support
2019-03-21 21:26:16 +01:00
Tibor Vass 1ba368a5ac container: --gpus support
Signed-off-by: Tibor Vass <tibor@docker.com>
2019-03-21 20:14:25 +00:00
Tibor Vass bc5ad41e87
Merge pull request #1766 from tonistiigi/outputs
build: allow setting buildkit outputs
2019-03-21 10:49:46 -07:00
Tonis Tiigi ca6eb5049b build: allow setting buildkit outputs
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-03-21 10:27:59 -07:00
Simon Ferquel 470afe11ed Fix annnotation on docker config create --template-driver
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2019-03-21 16:19:06 +01:00
Sunny de3a5f0fe5
Add `--pids-limit` flag to `docker update`
Signed-off-by: Sunny Gogoi <indiasuny000@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-21 01:20:32 +01:00
Vincent Demeester f762697628
Merge pull request #1756 from thaJeztah/bump_engine_no_buildkit
Update docker/docker, containerd, runc, and some dependencies
2019-03-20 11:35:55 +01:00
Sebastiaan van Stijn fd769e1aff
Update docker/docker to 827cb09f87964ed38b46502f22a585f2ed4a78e1
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-19 22:21:51 +01:00
Sebastiaan van Stijn f620349837
Add systctl support for services
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-19 13:33:32 +01:00
Vincent Demeester a4a50de4b8
Merge pull request #1671 from thaJeztah/fix_labels_expanding_env_vars
Fix labels copying value from environment variables
2019-03-19 12:18:55 +01:00
Vincent Demeester fc9ef7087e
Merge pull request #1732 from sjeandeaux/fix/issue-117
[pretty print] pretty print and healthcheck
2019-03-19 11:54:41 +01:00
Sebastiaan van Stijn b5d0d179e7
Add back validation for invalid label values on containers
This adds validation to `docker container run` / `docker container create`;

Validation of labels provided through flags was removed in 31dc5c0a9a,
after the validation was changed to fix labels without values, and to prevent
labels from being expanded with environment variables in 2b17f4c8a8

However, now empty label names from _files_ (`--label-file`) followed different
validation rules than labels passed through `--label`.

This patch adds back minimal validation for labels passed through the command-line

Before this patch:

```bash
docker container create \
  --name label \
  --label==with-leading-equal-sign \
  --label=without-value \
  --label=somelabel=somevalue \
  --label "  =  " \
  --label=with-quotes-in-value='{"foo"}' \
  --label='with"quotes"in-key=test' \
  busybox

docker container inspect --format '{{json .Config.Labels}}' label
```

```json
{
  "": "with-leading-equal-sign",
  "  ": "  ",
  "somelabel": "somevalue",
  "with\"quotes\"in-key": "test",
  "with-quotes-in-value": "{\"foo\"}",
  "without-value": ""
}
```

After this patch:

```bash
docker container create \
  --name label \
  --label==with-leading-equal-sign \
  --label=without-value \
  --label=somelabel=somevalue \
  --label "  =  " \
  --label=with-quotes-in-value='{"foo"}' \
  --label='with"quotes"in-key=test' \
  busybox

invalid argument "=with-leading-equal-sign" for "-l, --label" flag: invalid label format: "=with-leading-equal-sign"
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-19 03:02:06 +01:00
Sebastiaan van Stijn f2424bd375
Fix labels copying value from environment variables
This patch fixes a bug where labels use the same behavior as `--env`, resulting
in a value to be copied from environment variables with the same name as the
label if no value is set (i.e. a simple key, no `=` sign, no value).

An earlier pull request addressed similar cases for `docker run`;
2b17f4c8a8, but this did not address the
same situation for (e.g.) `docker service create`.

Digging in history for this bug, I found that use of the `ValidateEnv`
function for  labels was added in the original implementation of the labels feature in
abb5e9a077 (diff-ae476143d40e21ac0918630f7365ed3cR34)

However, the design never intended it to expand environment variables,
and use of this function was either due to either a "copy/paste" of the
equivalent `--env` flags, or a misunderstanding (the name `ValidateEnv` does
not communicate that it also expands environment variables), and the existing
`ValidateLabel` was designed for _engine_ labels (which required a value to
be set).

Following the initial implementation, other parts of the code followed
the same (incorrect) approach, therefore leading the bug to be introduced
in services as well.

This patch:

- updates the `ValidateLabel` to match the expected validation
  rules (this function is no longer used since 31dc5c0a9a),
  and the daemon has its own implementation)
- corrects various locations in the code where `ValidateEnv` was used instead of `ValidateLabel`.

Before this patch:

```bash
export SOME_ENV_VAR=I_AM_SOME_ENV_VAR
docker service create --label SOME_ENV_VAR --tty --name test busybox

docker service inspect --format '{{json .Spec.Labels}}' test
{"SOME_ENV_VAR":"I_AM_SOME_ENV_VAR"}
```

After this patch:

```bash
export SOME_ENV_VAR=I_AM_SOME_ENV_VAR
docker service create --label SOME_ENV_VAR --tty --name test busybox

docker container inspect --format '{{json .Config.Labels}}' test
{"SOME_ENV_VAR":""}
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-19 03:01:57 +01:00
Stephane Jeandeaux d4ad7a94d2 [#117] remove blank line and fix order
Signed-off-by: Stephane Jeandeaux <stephane.jeandeaux@gmail.com>
2019-03-18 21:37:22 -04:00
Sebastiaan van Stijn 8c3a619d13
Merge pull request #1740 from tonistiigi/platform-flag
build: enable platform flag for build if buildkit
2019-03-18 19:21:46 +01:00
Tonis Tiigi 2caffb12c7 build: enable platform flag for build if buildkit
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-03-18 10:37:08 -07:00
Sebastiaan van Stijn 26e004797b
Make system prune warning filters human-readable
The warning, printed before running `docker system prune` was printing the
filters in JSON format.

This patch attempts to make the output human readable;

- updating the code, and template to print filters individually
- reducing the indentation (which was quite deep)

Before this patch was applied;

```
docker system prune --filter until=24h --filter label=hello-world --filter label!=foo=bar --filter label=bar=baz

WARNING! This will remove:
        - all stopped containers
        - all networks not used by at least one container
        - all dangling images
        - all dangling build cache
        - Elements to be pruned will be filtered with:
        - label={"label":{"bar=baz":true,"hello-world":true},"label!":{"foo=bar":true},"until":{"24h":true}}
Are you sure you want to continue? [y/N]
```

With this patch applied;

```
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all dangling images
  - all dangling build cache

  Items to be pruned will be filtered with:
  - label!=foo=bar
  - label!=never=remove-me
  - label=bar=baz
  - label=hello-world
  - label=remove=me
  - until=24h

Are you sure you want to continue? [y/N]
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-18 13:57:18 +01:00
Sebastiaan van Stijn 4a0218bb11
Fix system prune warning missing filters from config-file
The warning, printed before runing docker system prune was missing any filter
that was set in the configuration file. In addition, the warning prefixes the
filters with `label=`, which is no longer accurate, now that the prune command
also supports "until" as a filter.

Before this change, only the filters set on the command-line were shown,
and any filter set in the configuration file was missing;

```
mkdir -p ./test-config
echo '{"pruneFilters": ["label!=never=remove-me", "label=remove=me"]}' > test-config/config.json
docker --config=./test-config system prune --filter until=24h --filter label=hello-world --filter label!=foo=bar --filter label=bar=baz

WARNING! This will remove:
        - all stopped containers
        - all networks not used by at least one container
        - all dangling images
        - all dangling build cache
        - Elements to be pruned will be filtered with:
        - label={"label":{"bar=baz":true,"hello-world":true},"label!":{"foo=bar":true},"until":{"24h":true}}
Are you sure you want to continue? [y/N]
```

With this patch applied, both options from the commandline and options set
in the configuration file are shown;

```
mkdir -p ./test-config
echo '{"pruneFilters": ["label!=never=remove-me", "label=remove=me"]}' > test-config/config.json
docker --config=./test-config system prune --filter until=24h --filter label=hello-world --filter label!=foo=bar --filter label=bar=baz

WARNING! This will remove:
        - all stopped containers
        - all networks not used by at least one container
        - all dangling images
        - all dangling build cache
        - Elements to be pruned will be filtered with:
        - filter={"label":{"bar=baz":true,"hello-world":true,"remove=me":true},"label!":{"foo=bar":true,"never=remove-me":true},"until":{"24h":true}}
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-18 13:57:09 +01:00
Jean-Christophe Sirot b3aa17187f Make default context behaves like a real context:
- when using "--context default" parameter
- when printing the list of contexts
- when exporting the default context to a tarball

Signed-off-by: Jean-Christophe Sirot <jean-christophe.sirot@docker.com>
(+1 squashed commit)
Squashed commits:
[20670495] Fix CLI initialization for the `docker stack deploy --help` command and ensure that the dockerCli.CurrentContext() always returns a non empty context name (default as a fallback)
Remove now obsolete code handling empty string context name
Minor code cleanup

Signed-off-by: Jean-Christophe Sirot <jean-christophe.sirot@docker.com>
2019-03-18 11:45:46 +01:00
Jean-Christophe Sirot a1af6e261f Cover the changes with unit test
Signed-off-by: Jean-Christophe Sirot <jean-christophe.sirot@docker.com>
2019-03-13 14:18:41 +01:00
Jean-Christophe Sirot 37fcaf7a29 Resolve the docker Endpoint even if the client already exists. In that case the `TestDialStdio` e2e test had to be modified: the `--tls` option triggers an error since the endpoint resolution tries to read the `${DOCKER_CERT_PATH}/ca.pem` file which does not exist.
Signed-off-by: Jean-Christophe Sirot <jean-christophe.sirot@docker.com>
2019-03-13 14:18:41 +01:00
Jean-Christophe Sirot 3b26cfce8b Always initialize context store
Signed-off-by: Jean-Christophe Sirot <jean-christophe.sirot@docker.com>
2019-03-13 14:18:41 +01:00
Sebastiaan van Stijn d6a230606c
Merge pull request #1718 from ijc/dial-stdio-npipe-on-windows
dial-stdio: handle connections which lack CloseRead method.
2019-03-13 11:49:25 +01:00
Stephane Jeandeaux 05674a5096 [pretty print] pretty print and healthcheck
fixes #117

Print healthcheck information in pretty mode.

Signed-off-by: Stephane Jeandeaux <stephane.jeandeaux@gmail.com>
2019-03-12 22:00:46 -04:00
Tibor Vass 81ac432cc2
Merge pull request #1700 from thaJeztah/update_engine
Update docker/docker 8aca18d, containerd v1.2.4
2019-03-12 10:41:51 -07:00
Ian Campbell 0449ad8d06 Revert "Disable `docker system dial-stdio` on Windows"
This reverts commit c41c23813c.

This case is now handled due to the previous commit.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-03-12 14:57:52 +00:00
Ian Campbell 186e7456ac dial-stdio: Close the connection
This was leaking the fd.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-03-12 14:57:40 +00:00
Ian Campbell 8919bbf04d dial-stdio: handle connections which lack CloseRead method.
This happens on Windows when dialing a named pipe (a path which is used by CLI
plugins), in that case some debugging shows:

    DEBU[0000] conn is a *winio.win32MessageBytePipe
    DEBU[0000] conn is a halfReadCloser: false
    DEBU[0000] conn is a halfWriteCloser: true
    the raw stream connection does not implement halfCloser
In such cases we can simply wrap with a nop function since closing for read
isn't too critical.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-03-12 14:52:42 +00:00
Sebastiaan van Stijn bf4a96e564
Merge pull request #1688 from luoyunpeng/optimize-blockIOTypecheck
use char to check blockIO type
2019-03-12 10:32:31 +01:00
Silvin Lubecki b86bff84b6
Merge pull request #1710 from ijc/no-dial-stdio-on-windows
Disable `docker system dial-stdio` on Windows
2019-03-11 15:14:23 +01:00
Elliot Luo 0bb397f9ef use char to check blockIO type
Signed-off-by: Elliot Luo <956941328@qq.com>
2019-03-11 10:01:22 +08:00
Ryan Zhang f60369dfe6 Export cli/command/config
Signed-off-by: Ryan Zhang <ryan.zhang@docker.com>
2019-03-05 14:26:42 -08:00
Ian Campbell c41c23813c Disable `docker system dial-stdio` on Windows
The `conn` here is `*winio.win32MessageBytePipe` which does not have a
`CloseRead` method (it does have `CloseWrite`) resulting in:

    docker@WIN-NUC0 C:\Users\docker>.\docker-windows-amd64.exe system dial-stdio
    the raw stream connection does not implement halfCloser

Also disable the path which uses this for cli-plugins on Windows.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-03-04 17:36:21 +00:00
Sebastiaan van Stijn 0fc0015173
bump docker/docker to 8aca18d631f3f72d4c6e3dc01b6e5d468ad941b8
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-02 13:41:42 +01:00
Ian Campbell 3c2832637a Reformat the output of CLI plugins in `docker system info`
This matches the `docker --help` output after 92013600f9.

Added a unit test case for unversioned.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-02-25 13:13:51 +00:00
Sebastiaan van Stijn f1de399a54
Merge pull request #1612 from olljanat/replicas-max-per-node-cli
Add support for maximum replicas per node without stack
2019-02-22 11:17:18 +01:00
Olli Janatuinen f7f4d3bbb8 Add support for maximum replicas per node without stack
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2019-02-22 09:53:21 +02:00
Sebastiaan van Stijn 06b837a7d7
Merge pull request #1654 from ijc/plugins-dial-stdio
cli-plugins: use system dial-stdio to contact the engine.
2019-02-21 12:11:24 +01:00
Ian Campbell 891b3d953e cli-plugins: use `docker system dial-stdio` to call the daemon
This means that plugins can use whatever methods the monolithic CLI supports,
which is good for consistency.

This relies on `os.Args[0]` being something which can be executed again to
reach the same binary, since it is propagated (via an envvar) to the plugin for
this purpose. This essentially requires that the current working directory and
path are not modified by the monolithic CLI before it launches the plugin nor
by the plugin before it initializes the client. This should be the case.

Previously the fake apiclient used by `TestExperimentalCLI` was not being used,
since `cli.Initialize` was unconditionally overwriting it with a real one
(talking to a real daemon during unit testing, it seems). This wasn't expected
nor desirable and no longer happens with the new arrangements, exposing the
fact that no `pingFunc` is provided, leading to a panic. Add a `pingFunc` to
the fake client to avoid this.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-02-18 11:53:37 +00:00
Silvin Lubecki 7f612bfca6
Merge pull request #1529 from lifubang/ttyexecresize
fixes 1492: tty initial size error
2019-02-12 10:31:17 +01:00
Lifubang 3fbffc682b tty initial size error
Signed-off-by: Lifubang <lifubang@acmcoder.com>
Signed-off-by: lifubang <lifubang@acmcoder.com>
2019-02-12 09:14:50 +08:00
Tibor Vass 60e774305d
Merge pull request #1602 from thaJeztah/hide_experimental_deploy
Hide legacy top-level "deploy" command with DOCKER_HIDE_LEGACY_COMMANDS=1
2019-02-08 13:53:12 -08:00
Sebastiaan van Stijn d21d1ce675
Merge pull request #1648 from thaJeztah/hide_builder_and_network
Hide "builder" and "network" commands on old API versions
2019-02-07 18:34:08 +01:00
Silvin Lubecki b1d27091e5
Merge pull request #1515 from sw-pschmied/1514-prevent-replacing-irregular-files
Prevent overwriting irregular files (cp, save, export commands)
2019-02-07 10:05:02 +01:00
Philipp Schmied 7632776b35 Prevent overwriting irregular files (cp, save, export commands)
Signed-off-by: Philipp Schmied <pschmied@schutzwerk.com>
2019-02-07 09:17:35 +01:00
Vincent Demeester 8ef8df81a8
Merge pull request #1655 from thaJeztah/bump_engine
Update docker, swarmkit, containerd v1.2.2
2019-02-06 18:24:05 +01:00
John Howard 593acf077b Add --device support for Windows
Adds support for --device in Windows. This must take the form of:
--device='class/clsid'. See this post for more information:

https://blogs.technet.microsoft.com/virtualization/2018/08/13/bringing-device-support-to-windows-server-containers/

Signed-off-by: John Howard <jhoward@microsoft.com>
2019-02-04 08:32:47 -08:00
Sebastiaan van Stijn d034df736b
Update docker, swarmkit, containerd v1.2.2
Also update the tests to account for the new "Builder" field
in docker info.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-02-02 17:03:12 +01:00
Tonis Tiigi 27b2797f7d Remove docker api dependency from cli/config
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tibor Vass <tibor@docker.com>
2019-01-31 21:25:43 +00:00
Silvin Lubecki 2e5639da02
Merge pull request #1564 from ijc/plugins
Basic framework for writing and running CLI plugins
2019-01-31 17:44:46 +01:00
Sebastiaan van Stijn 5486cddbd9
Merge pull request #1617 from simonferquel/pull-secrets
Add support for Kubernetes Pull secrets and Pull policies
2019-01-31 13:37:45 +01:00
Ian Campbell 1c576e9043 Integrate CLI plugins into `docker info`
Fairly straight forward. It became necessary to wrap `Plugin.Err` with a type
which implements `encoding.MarshalText` in order to have that field rendered
properly in the `docker info -f '{{json}}'` output.

Since I changed the type somewhat I also added a unit test for `formatInfo`.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-01-30 13:45:26 +00:00
Sebastiaan van Stijn 99fb2c1baa
Hide "builder" and "network" commands on old API versions
- The `/build/prune` endpoint was added in API v1.31
- The `/network` endpoints were added in API v1.21

This patch hides these commands on older API versions

Before this change:

```
DOCKER_API_VERSION=1.0 docker

...

Management Commands:
  builder     Manage builds
  container   Manage containers
  image       Manage images
  manifest    Manage Docker image manifests and manifest lists
  network     Manage networks
  system      Manage Docker
  trust       Manage trust on Docker images
```

After this change

```
DOCKER_API_VERSION=1.0 docker

...

Management Commands:
  container   Manage containers
  image       Manage images
  manifest    Manage Docker image manifests and manifest lists
  system      Manage Docker
  trust       Manage trust on Docker images
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-30 01:06:09 +01:00
Simon Ferquel d184c0908a Add support for pull secrets and policies
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2019-01-29 18:12:43 +01:00
Silvin Lubecki b258f458cc
Merge pull request #1573 from thaJeztah/fix_proxy_on_create
Fix proxy-configuration being ignored on docker create
2019-01-29 18:11:06 +01:00
Ian Campbell 8cf946d1bc Unit test for WithContentTrustFromEnv
I authored this for `contentTrustEnabled` prior to 7f207f3f95, so this now
tests the funcation argument version.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-01-29 11:26:40 +00:00
Ian Campbell 20c19830a9 Move versioning variables to a separate package.
This helps to avoid circular includes, by separating the pure data out from the
actual functionality in the cli subpackage, allowing other code which is
imported to access the data.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-01-29 11:26:40 +00:00
Ian Campbell 158a766886 Fold `dockerPreRun` into `DockerCli.Initialize`
All of the current callers follow the pattern:

    dockerPreRun(opts)
    err := dockerCli.Initialize(opts) ...

So there is no semantic change into merging the content of `dockerPreRun` into the head of `Initialize`.

I'm about to add a new caller outside of the `cmd/docker` package and this
seems preferable exporting `DockerPreRun`.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-01-29 11:26:21 +00:00
Simon Ferquel 3126920af1 Add context store config options and expose context commands
This will allow plugins to have custom typed endpoints, as well as
create/remove/update contexts with the exact same results as the main
CLI (thinking of things like `docker ee login https://my-ucp-server
--context ucp-prod)`

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2019-01-29 11:19:54 +01:00
Sebastiaan van Stijn cf6c238660
Merge pull request #1615 from simonferquel/handle-v1alpha3
Handle v1alpha3 of Compose on Kubernetes API
2019-01-28 21:02:51 +01:00
Silvin Lubecki 7f207f3f95 Introduce functional arguments to NewDockerCli for a more stable API.
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2019-01-28 14:52:58 +01:00
Silvin Lubecki eb0ba4f8d5 Extract streams helpers from command package to their own package to remove a cyclic dependency from command to internal/containerizedengine
Aliasing old types
* streams.InStream -> streams.In
* streams.NewInStream -> streams.NewIn
* streams.OutStream -> streams.Out
* streams.NewOutStream -> streams.NewOut

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2019-01-28 14:36:00 +01:00
Sebastiaan van Stijn 080f30a60f
Merge pull request #1638 from ijc/separate-client-system-info
Separate client infomation in `docker system info`
2019-01-25 17:32:07 +01:00
Ian Campbell bcb06b5f58 Rework `docker info` output to be more like `docker version`
That is, reindent the two sections by one space.

While the code was done by hand the `.golden` files had the extra space
inserted with emacs' `string-insert-rectangle` macro to (try to) avoid possible
manual errors. The docs were edited the same way.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-01-25 14:46:26 +00:00
Ian Campbell c9e60ae17a Allow `prettyPrintInfo` to return multiple errors
This allows it to print what it can, rather than aborting half way when a bad
security context is hit.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-01-25 14:40:33 +00:00
Ian Campbell 62ed1c0c5b Separate client and daemon info in `docker system info`
Right now the only client side info we have is whether debug is enabled, but we
expect more in the future.

We also preemptively prepare for the possibility of multiple errors when
gathering both daemon and client info.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-01-25 14:38:04 +00:00
Ian Campbell 7913fb6a5e Check json output in existing `docker info` unit tests.
This is in addition to the more specific `formatInfo` unit tests added
previously.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-01-25 11:55:54 +00:00
Ian Campbell eb714f7c0e Add unit test for `formatInfo`.
Signed-off-by: Ian Campbell <ijc@docker.com>
2019-01-25 11:55:52 +00:00
Simon Ferquel 820b6f1742 Added stack conversion tests
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2019-01-25 09:58:31 +01:00
Simon Ferquel 2e5981d613 Handle version v1alpha3
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2019-01-24 20:24:45 +01:00
Silvin Lubecki ebb121ee2d
Merge pull request #1611 from simonferquel/stack-children-atomic
Make child resource creation atomic when creating a k8s stack
2019-01-24 11:34:29 +01:00
Simon Ferquel e16a875408 Make child resource creation atomic when creating a k8s stack
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2019-01-22 11:25:41 +01:00
Sebastiaan van Stijn 91bc4ddde2
Fix: proxy-configuration being ignored on docker create
Proxies configured in config.json were only taking effect
when using `docker run`, but were being ignored when
using `docker create`.

Before this change:

    echo '{"proxies":{"default":{"httpProxy":"httpProxy","httpsProxy":"httpsProxy","noProxy":"noProxy","ftpProxy":"ftpProxy"}}}' > config.json
    docker inspect --format '{{.Config.Env}}' $(docker --config=./ create busybox)
    [PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin]

With this change applied:

    echo '{"proxies":{"default":{"httpProxy":"httpProxy","httpsProxy":"httpsProxy","noProxy":"noProxy","ftpProxy":"ftpProxy"}}}' > config.json
    docker inspect --format '{{.Config.Env}}' $(docker --config=./ create busybox)
    [NO_PROXY=noProxy no_proxy=noProxy FTP_PROXY=ftpProxy ftp_proxy=ftpProxy HTTP_PROXY=httpProxy http_proxy=httpProxy HTTPS_PROXY=httpsProxy https_proxy=httpsProxy PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin]

Reported-by: Silvano Cirujano Cuesta <Silvanoc@users.noreply.github.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-19 12:33:33 +01:00
Silvin Lubecki cf0271ace4 Expose all stack commands to be used by downstream projects.
Factorize orchestrator switch among stack commands.

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2019-01-16 14:47:50 +01:00
Sebastiaan van Stijn 48bd4c6deb
Merge pull request #1501 from simonferquel/use-context-commands
Fast context switch: commands
2019-01-15 18:11:38 +01:00
Simon Ferquel 591385a1d0 Fast Context Switch: commands
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2019-01-10 22:25:43 +01:00
Akihiro Suda a7b5f2df86 support --mount type=bind,bind-nonrecursive,...
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2019-01-10 12:07:46 +09:00
Silvin Lubecki 308b1f340a
Merge pull request #1572 from thaJeztah/minor_test_nit
TestRunLabel: pass detach as argument
2019-01-08 10:17:01 +01:00
Silvin Lubecki edf6f4a3e7
Merge pull request #1571 from thaJeztah/warn_on_create
Fix warnings not being printed on "create", only on "run"
2019-01-08 10:14:01 +01:00
Daniel Hiltgen b9f1d30fa7
Remove e-mail from trial flow
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
(cherry picked from commit 0ff9e5cd10)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-08 00:35:24 +01:00
Sebastiaan van Stijn 4c0aa94698
Hide legacy top-level "deploy" command with DOCKER_HIDE_LEGACY_COMMANDS=1
The `DOCKER_HIDE_LEGACY_COMMANDS` environment variable allows hiding legacy
top-level commands that are now available under `docker <object> <verb>`. The
`docker deploy` top-level command is experimental, and replaced by
`docker stack deploy`.

This patch hides the top-level `docker deploy` if the `DOCKER_HIDE_LEGACY_COMMANDS`
environment variable is set.

Before this change:

    DOCKER_HIDE_LEGACY_COMMANDS=1 docker --help

    ...

    Commands:
      build       Build an image from a Dockerfile
      deploy      Deploy a new stack or update an existing stack
      login       Log in to a Docker registry
      logout      Log out from a Docker registry
      run         Run a command in a new container
      search      Search the Docker Hub for images
      version     Show the Docker version information
    ...

With this patch applied:

    DOCKER_HIDE_LEGACY_COMMANDS=1 docker --help

    ...

    Commands:
      build       Build an image from a Dockerfile
      login       Log in to a Docker registry
      logout      Log out from a Docker registry
      run         Run a command in a new container
      search      Search the Docker Hub for images
      version     Show the Docker version information
    ...

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-07 17:24:35 +01:00
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 7c514a31c9
Fix warnings not being printed on "create", only on "run"
Previously, these errors were only printed when using `docker run`, but were
omitted when using `docker container create` and `docker container start`
separately.

Given that these warnings apply to both situations, this patch moves generation
of these warnings to `docker container create` (which is also called by
`docker run`)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-13 14:21:34 +01:00
Sebastiaan van Stijn eb1b4b83c9
TestRunLabel: pass detach as argument
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-12-13 13:23:30 +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
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
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
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
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
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
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
Michael Crosby eacb812c26 Install binaries on host for upgrade
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
(cherry picked from commit cfec8027ed)
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
2018-09-21 15:40:35 -07:00
Arash Deshmeh e9dc2293b1 refactor stack list command unit tests to table-driven
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-09-19 22:13:03 -04:00
Arash Deshmeh fc1e11d46a moved integration test TestExportContainerWithOutputAndImportImage from moby/moby to docker/cli.
The integration test TestExportContainerWithOutputAndImportImage in moby/moby is the same as TestExportContainerAndImportImage,
except for the output file option. Adding a unit test to cover the output file option of the export command here allows
the removal of the redundant integration test TestExportContainerWithOutputAndImportImage.

Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-09-18 12:30:49 -04:00
Sebastiaan van Stijn b4180e8757
Merge pull request #1371 from jhowardmsft/jjh/importlcow
LCOW: --platform on import (already in API)
2018-09-14 13:00:20 +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
John Howard b55a0b681f LCOW: --platform on import (already in API)
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-09-13 15:04:04 -07:00
Sebastiaan van Stijn 1921a6c051
Merge pull request #1354 from nashasha1/fix/some-typo
Fix some typo
2018-09-12 14:53:38 +02:00
Sebastiaan van Stijn bd906df601
Merge pull request #1352 from Lihua93/fix/typo
Typo fix
2018-09-12 14:28:05 +02:00
Sebastiaan van Stijn 82dff32bb4
Merge pull request #1362 from vdemeester/engine-only-linux
Add `docker engine` commands only on Linux…
2018-09-11 16:52:01 +02:00
Silvin Lubecki 2eb9b0cba2
Merge pull request #1361 from vdemeester/contains-containerized
Remove containerizedengine package dependency from docker/cli/command…
2018-09-11 15:54:13 +02:00
Vincent Demeester a3a955f204
Add `docker engine` commands only on Linux…
… this is, for now, the only platform that is supported

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-09-11 15:23:22 +02:00
Vincent Demeester 2d344b2f61
Remove containerizedengine package dependency from docker/cli/command…
… this removes a whole lot of dependencies from people depending on docker/cli…

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-09-11 14:46:30 +02:00
Joffrey F e7788d6f9a Allow marshalling of Compose config to JSON
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-09-10 11:16:05 -07:00
Xiaodong Zhang f8e04011e4 Fix some typo
Signed-off-by: Xiaodong Zhang <a4012017@sina.com>
2018-09-07 17:18:00 +08:00
Lihua Tang ca5e453180 Typo fix
Signed-off-by: Lihua Tang <lhtang@alauda.io>
2018-09-07 13:28:02 +08: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
Harald Albers 0fb4256a00 Add bash completion for `manifest` command family
Signed-off-by: Harald Albers <github@albersweb.de>
2018-08-30 08:54:49 +02:00
Arash Deshmeh 14b696a297 added unit tests to plugin inspect command
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-08-29 16:48:43 -04: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 a500c394df
Move "session" support out of experimental for API 1.39 and up
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-08-22 00:51:19 +02:00
Sebastiaan van Stijn 60c75fda67
Remove "experimental" annotations for buildkit
BuildKit can now be enabled without the daemon having
experimental features enabled.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-08-22 00:38:59 +02: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
Anda Xu acf43b62b5 vendor dependency
Signed-off-by: Anda Xu <anda.xu@docker.com>
2018-08-20 15:32:25 -07:00
Anda Xu ef09ca8987 enable buildkit as builder from daemon; no env var needs to be set
Signed-off-by: Anda Xu <anda.xu@docker.com>
2018-08-20 11:59:39 -07:00
Daniel Hiltgen fd2f1b3b66 Add engine commands built on containerd
This new collection of commands supports initializing a local
engine using containerd, updating that engine, and activating
the EE product

Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
2018-08-20 09:42:05 -07:00
mmacy c11acddfb5 [WIP] fix trust inspect typo 'AdminstrativeKeys'
Signed-off-by: mmacy <marsma@microsoft.com>
2018-08-19 17:57:04 -07:00
Andrew Hsu f472a1a480
Merge pull request #1296 from tiborvass/build-progress-flag-no-api-requirement
build: Remove API requirement for --progress as it is CLI only
2018-08-17 18:31:25 -07:00
Andrew Hsu b3d8c5deda
Merge pull request #1295 from tiborvass/cmd-builder-prune-no-options
builder: Implement `builder prune` to prune build cache
2018-08-17 18:28:37 -07:00
Tibor Vass 50f918801f build: Remove API requirement for --progress as it is CLI only
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-08-17 16:24:02 +00:00
Tibor Vass f597f2d026 Add new `builder` subcommand and implement `builder prune` to prune build cache.
This patch adds a new builder subcommand, allowing to add more builder-related
commands in the future. Unfortunately `build` expects an argument so could not
be used as a subcommand.

This also implements `docker builder prune`, which is needed to prune the builder
cache manually without having to call `docker system prune`.

Today when relying on the legacy builder, users are able to prune dangling images
(used as build cache) by running `docker image prune`. This patch allows the
same usecase with buildkit.

Signed-off-by: Tibor Vass <tibor@docker.com>
2018-08-17 15:18:18 +00:00
Tibor Vass c4c4825591 build: implement build secrets with buildkit
This patch implements `docker build --secret id=mysecret,src=/secret/file`
for buildkit frontends that request the mysecret secret.

It is currently implemented in the tonistiigi/dockerfile:secrets20180808
frontend via RUN --mount=type=secret,id=mysecret

Signed-off-by: Tibor Vass <tibor@docker.com>
2018-08-17 14:01:32 +00:00
Tibor Vass 964173997d
Merge pull request #1276 from tiborvass/buildkit-progress-flag
build: change --console=[auto,false,true] to --progress=[auto,plain,tty]
2018-08-15 20:42:47 -07:00
Brian Goff e92614a175
Merge pull request #1014 from AkihiroSuda/connhelper-sshonly
support SSH connection
2018-08-14 15:12:06 -07:00
Arash Deshmeh 340e4ee8e5 refactor stack ps tests to table-driven
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-08-10 15:13:45 -04:00
Silvin 3a3e720f91
Merge pull request #1283 from adshmh/refactor-trust-revoke-tests
refactor trust revoke command unit tests
2018-08-10 11:03:58 +02:00
Vincent Demeester 560b0cd863
Merge pull request #1280 from adshmh/refactor-trust-inspect-tests
refactor trust inspect command unit tests
2018-08-10 10:37:53 +02:00
Arash Deshmeh 984d76b9dd refactored trust revoke command unit tests to use table-driven style
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-08-09 15:58:54 -04:00
Arash Deshmeh f8f0d72cf9 refactor trust inspect command unit tests to table-driven style
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-08-08 13:50:00 -04:00
Arash Deshmeh 5cc1f9006a use sortorder lib for sorting the output of volume list command
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-08-08 12:20:21 -04:00
Arash Deshmeh 04bb3c770f use sortorder lib for sorting in trust package
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-08-08 12:20:10 -04:00
Arash Deshmeh a921313caf use sortorder lib for sorting network list output
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-08-08 12:06:59 -04:00
Tibor Vass faeb8bb571 build: change --console=[auto,false,true] to --progress=[auto,plain,tty]
This changes the experimental --console flag to --progress following
feedback indicating avoidable confusion.

In addition to naming changes, the help output now has an additional
clarification, specifically: container output during builds are only
shown when progress output is set to plain. Not mentioning this was also
a big cause of confusion.

Signed-off-by: Tibor Vass <tibor@docker.com>
2018-08-07 18:18:13 +00:00
Arash Deshmeh 021bf39d76 refactor network list unit tests to table-driven style
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-08-02 14:07:06 -04:00
Arash Deshmeh 4f388ffca3 add unit test to cover the sort order of network list command
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-08-02 14:07:06 -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
Silvin Lubecki 21cce52b30 Fix help message flags on docker stack commands and sub-commands
PersistentPreRunE needs to be called within the help function to initialize all the flags (notably the orchestrator flag)
Add an e2e test as regression test

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2018-08-01 01:48:27 +02:00
Vincent Demeester 19653e7fad
Merge pull request #1240 from thaJeztah/datapath_addr_api_annotation
Add API-version anotation for --data-path-addr
2018-07-30 17:47:52 +02:00
Silvin 6cd0e2fe70
Merge pull request #1222 from thaJeztah/its_not_standard_but_its_in
Update --compose-file flag description to mention stdin
2018-07-30 16:23:29 +02:00
Sebastiaan van Stijn 91b1ad9d2b
Add API-version anotation for --data-path-addr
This flag was added in Docker 17.06, API version 1.31 through
moby@8dc8cd4719f165c01c98e7d3ce1d6cea6a8f60b8, but didn't add
API-version annotations.

This patch adds the missing annotations to hide this flag if
the CLI is connected to an older version of the daemon that
doesn't support that API.

Before this patch:

    DOCKER_API_VERSION=1.30 docker swarm init --help | grep data-path-addr
          --data-path-addr string           Address or interface to use for data path traffic (format: <ip|interface>)

    DOCKER_API_VERSION=1.31 docker swarm init --help | grep data-path-addr
          --data-path-addr string           Address or interface to use for data path traffic (format: <ip|interface>)

With this patch applied:

    DOCKER_API_VERSION=1.30 docker swarm init --help | grep data-path-addr
    # (no result)

    DOCKER_API_VERSION=1.31 docker swarm init --help | grep data-path-addr
          --data-path-addr string           Address or interface to use for data path traffic (format: <ip|interface>)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-30 11:05:20 +02: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 2c7822b036
Update --compose-file flag description to mention stdin
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-19 14:55:48 +02:00
Justyn Temme bdd58a4096 Update deploy.go
Clarified ambiguous error message

Update kubernetes/cli.go

Infromed user of why the error was caused when file is not there

Signed-off-by: Justyn Temme <justyntemme@gmail.com>
2018-07-17 09:14:05 -05:00
Sebastiaan van Stijn 9847e96765
Update hints for linting
- remove some hints that are no longer needed
- added a nolint: unparam for removeSingleSigner() (return bool is only used in tests)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-13 11:18:50 +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
Sebastiaan van Stijn c8b9c21ef9
Merge pull request #1178 from cyli/fix-swarm-ca-command
Propagate the provided external CA certificate to the external CA object in swarm
2018-07-10 01:31:32 +02:00
Arash Deshmeh 71d650ee17 refactored cli/compose and cli/command/trust to use sort.Slice and removed custom types used for sorting
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-07-08 15:08:17 -04:00
Arash Deshmeh ceed42217d refactored all commands under cli/command/ to use sort.Slice instead of declaring custom types for sorting
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-07-06 15:49:32 -04:00
Vincent Demeester 2634562119
Merge pull request #1102 from sfluor/1074-fix-mapping-a-range-of-host-ports-to-a-single-container-port
Fix mapping a range of host ports to a single container port
2018-07-06 14:41:00 +02:00
Arash Deshmeh 26151d910a The output of plugin list command is sorted by plugin name
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-07-05 12:35:53 -04:00
Sami Tabet 29612ccefe Adding support of the long syntax publish notation
Signed-off-by: Sami Tabet <salph.tabet@gmail.com>
2018-07-05 00:33:13 +02:00
Silvin f285fe67e9
Merge pull request #1163 from thaJeztah/bump_engine
bump docker and dependencies
2018-07-04 16:17:12 +02:00
Sebastiaan van Stijn 5f6d5c7328 Bump docker and dependencies
Updates docker/docker to 1436dc8f8d0f6f60b6e335fbd918d6b22ee6574d,
matching 18.06.0-rc1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-04 01:14:40 +00:00
Tibor Vass 721000e6c9 build: use strconv.ParseBool to parse DOCKER_BUILDKIT to allow value "0"
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-07-03 23:14:06 +00:00
Tibor Vass 7b255e653a
Merge pull request #1176 from tiborvass/buildkit-iidfile
build: --iidfile support with buildkit
2018-07-03 15:36:23 -07:00
Tibor Vass c7e85c09d2 build: --iidfile support with buildkit
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-07-03 19:11:11 +00:00
Tõnis Tiigi 69e1743e3d
Merge pull request #1156 from dmcgowan/fix-manifest-list-size
Fix manifest lists to always use correct size
2018-07-03 11:27:19 -07:00
Ying Li 4243440e1f Propagate the provided external CA certificate to the external CA object
in swarm.

Also, fix some CLI command confusions:
1. If the --external-ca flag is provided, require a --ca-cert flag as well, otherwise
   the external CA is set but the CA certificate is actually rotated to an internal
   cert
2. If a --ca-cert flag is provided, require a --ca-key or --external-ca flag be
   provided as well, otherwise either the server will say that the request is
   invalid, or if there was previously an external CA corresponding to the cert, it
   will succeed.  While that works, it's better to require the user to explicitly
   set all the parameters of the new desired root CA.

This also changes the `swarm update` function to set the external CA's CACert field,
which while not strictly necessary, makes the CA list more explicit.

Signed-off-by: Ying Li <ying.li@docker.com>
2018-07-02 17:14:21 -07:00
Vincent Demeester 847e0c22d4
Remove composefiles lenght check on k8s RunDeploy..
The compose file(s) are already loaded at that point.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-07-02 15:00:19 +02:00
Silvin 18091ea7e2
Merge pull request #1170 from vdemeester/omit-silvin
Add omitempty on compose config top-level types
2018-07-02 14:16:53 +02:00
Vincent Demeester f05ab2b1fb
Add omitempty on compose config top-level types
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-07-02 12:04:09 +02:00
Vincent Demeester 9faf728089
Merge pull request #1155 from adshmh/add-unit-tests-to-plugin-list
added unit tests to cover plugin list command
2018-06-29 15:49:30 +02:00
Sebastiaan van Stijn 7c7c299eee
Merge pull request #1152 from vdemeester/extract-converter
Extract StackConverter from the StackClient
2018-06-29 13:36:55 +02:00
Derek McGowan 1fd2d66df8 Fix manifest lists to always use correct size
Stores complete OCI descriptor instead of digest and platform
fields. This includes the size which was getting lost by not
storing the original manifest bytes.

Attempt to support existing cached files, if not output
the filename with the incorrect content.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-06-28 18:17:38 -07:00
Arash Deshmeh c26121df5c added unit tests to cover plugin list command
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-06-28 16:51:54 -04:00
Arash Deshmeh bc9b42ea9b added unit tests covering content trust for plugin install command
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-06-27 22:16:19 -04:00
Vincent Demeester f2e6ee6899
Extract StackConverter from the StackClient
It makes it easier to get the correct stack from a compose config
struct without requiring the client (and thus talking to k8s API)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-27 16:41:00 +02:00
Vincent Demeester 0f9d24f78d
Refactor `stack` command/package
- Handle `bundlefile` directly in the `top-level`
  command. `bundlefile` is still experimental and will be deprecated
  in future version — this should make be easier to remove it.
- Validate the `stack` name in all cases (i.e. whatever the
  orchestrator is used)
- Load the composefile ahead of choosing the orchestrator. This
  removes some slight duplication.
- Makes `RunDeploy` easier to use from outside packages (like
  `docker/app`) with a preloaded configuration.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-26 14:07:26 +02:00
Sebastiaan van Stijn 61e53fc88a
Merge pull request #1138 from seemethere/env_experimental
Add env variable option for experimental
2018-06-25 14:47:16 +02:00
Eli Uriegas e3bb62ed51 Add env variable option for experimental
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
2018-06-24 21:15:02 +00:00
Arash Deshmeh d469cbdd14 fixed output leak from TestRunCommandWithContentTrustErrors unit tests
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-06-23 10:27:27 -04: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 e02c28f40a
Remove duplicated getOrchestrator(), and rename hideFlag()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-22 13:58:14 -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 0f07b9ffc7
Update command usage and documentation
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-21 23:16:27 -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
Sebastiaan van Stijn 8de0753869
Merge pull request #1112 from n4ss/fix-trust-signer-remove
Fix docker trust signer removal
2018-06-15 08:18:29 -07:00
Silvin 805b34127a
Merge pull request #1124 from vdemeester/using-cli-interface-everywhere-possible
Use command.Cli interface instead of concrete type…
2018-06-14 16:43:15 +02: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
Vincent Demeester e43c7920ea
Export Push and Save
As we did for `Pull`, it will be helpful to expose the push and save
implementation.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-14 15:48:21 +02:00
Vincent Demeester 70db8dee74
Merge pull request #479 from Tim15/init-option
Add --init option to `docker service create`
2018-06-14 13:58:52 +02:00
Vincent Demeester ff13f03def
Add --init option to `docker service create`
Signed-off-by: Timothy Higinbottom <timhigins@gmail.com>
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-14 13:50:12 +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
Tibor Vass b3a5c153d5 build: address some review nits
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-13 22:40:31 +00:00
Tibor Vass 5a103e1844 build: change --no-console to --console=[true|false|auto]
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-13 21:07:11 +00:00
Tibor Vass 00792d1704 build: ensure temporary folder is removed in error case
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-13 18:32:29 +00:00
Tibor Vass aef42093b8 build: skip moby.buildkit.trace Aux message to be future proof
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-13 18:32:28 +00:00
Tibor Vass 5919e8a30f build: fix lint issues + refactor
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-13 18:32:28 +00:00
Tibor Vass 15674d9ee9 build: simplify Close logic in WriteTempDockerfile
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-13 18:32:28 +00:00
Tibor Vass ed75f6202b build: add experimental --no-console flag to support non-tty human-readable output with buildkit
Unfortunately, this is for now the only way to see the output of RUN commands when using buildkit.
It is equivalent to `DOCKER_BUILDKIT=1 docker build . 2>&1 | cat`

Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-13 18:32:28 +00:00
Tibor Vass 584d59d8f5 formatter: fix TestDiskUsageContextFormatWrite expected output
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-13 18:32:28 +00:00
Tibor Vass b2b3f9c461 build: setting DOCKER_BUILDKIT environment variable to any non-empty string enables the use of buildkit
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-13 18:32:28 +00:00
Tibor Vass 640cbb8d2f build: fix output handling with buildkit (quiet option, redirects)
With this patch the following become true even with buildkit enabled:
1. `docker build -q .` only outputs the created image's sha256 ID.
2. `docker build -q .` outputs as if no `-q` was specified, if error occurred
3. `docker build . &> out` outputs JSON (instead of TTY characters)

Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-13 18:32:28 +00:00
Tibor Vass 82f0e1e5d8 build: fix `-f` handling with buildkit
This commit brings a more pedantic change in the following ambiguous case:
cat Dockerfile | docker build -f otherDockerfile -

The legacy builder does not error out and prefers the Dockerfile from stdin
while the buildkit-based one errors out.

Note that this is only in the case where stdin is a Dockerfile (not an archive)

Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-13 18:32:28 +00:00
Silvin 4cb3c70f36
Merge pull request #1121 from vdemeester/gotestyourself-with-tools
Update gotestyourself to gotest.tools
2018-06-11 14:49:20 +02:00
Tibor Vass 89e102474c build: error out if buildkit is on and stdin is used for both dockerfile and context
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-09 20:51:34 +00:00
Tibor Vass 5314a8fc06 build: Add support for using dockerfile from stdin with buildkit
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-09 20:51:34 +00:00
Tibor Vass e0b3921a03 build: Add support for using context from stdin with buildkit
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-09 20:51:34 +00:00
Tonis Tiigi 8cf213bd0c build: use a separate upload request for early progress
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-09 20:51:34 +00:00
Tonis Tiigi b19294ee42 system: add buildcache formatting
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-09 20:51:34 +00:00
Tonis Tiigi 0f97642915 build: basic buildkit progress support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-09 20:51:34 +00:00
Tonis Tiigi 656fe85c74 build: add experimental buildkit base
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-09 20:51:30 +00:00
Nassim 'Nass' Eddequiouaq 92c39dd0ab Fix removeSingleSigner description
Signed-off-by: Nassim 'Nass' Eddequiouaq <eddequiouaq.nassim@gmail.com>
2018-06-09 08:14:34 -07: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
Nassim 'Nass' Eddequiouaq 2b3361cc1a Move the successful removal print
Signed-off-by: Nassim 'Nass' Eddequiouaq <eddequiouaq.nassim@gmail.com>
2018-06-08 09:21:36 -07:00
Vincent Demeester b1065767cd
Bump moby version (and its dependencies)
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-08 11:26:10 +02:00
Nassim 'Nass' Eddequiouaq 5ebb7a65ab Fix tests and nit
Signed-off-by: Nassim 'Nass' Eddequiouaq <eddequiouaq.nassim@gmail.com>
2018-06-06 07:25:25 -07:00
Nassim 'Nass' Eddequiouaq 448082f333 Fix docker trust signer removal
Signed-off-by: Nassim 'Nass' Eddequiouaq <eddequiouaq.nassim@gmail.com>
2018-06-05 16:04:41 -07:00
Vincent Demeester eaa9149e29
Merge pull request #948 from simonferquel/k8s-watch-stack-status
K8s: more robust stack error detection on deploy
2018-06-04 10:42:42 +02:00
Vincent Demeester d1cc8c731e
Merge pull request #1105 from vdemeester/1044-compress-stream-friend
Fix panics when --compress and --stream are used together
2018-06-01 23:00:01 +02:00
Vincent Demeester 8b3dc39fce
Fix panics when --compress and --stream are used together
Warns that `-compress` has no effect when used together with the
expremintal `--stream` flag.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-01 18:34:00 +02:00
Vincent Demeester 7db15a4553
Merge pull request #1101 from silvin-lubecki/filter-stack-service
Fix service filtering by name on Kubernetes
2018-06-01 15:50:34 +02:00
Silvin Lubecki b1ff199167 Fix service filtering by name on Kubernetes to mimic Swarm filtering
*  Kubernetes native filtering (server side) is an exact match, now filtering on name is made client-side to add prefix-matching

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2018-06-01 15:43:02 +02:00
Sebastiaan van Stijn 1df6b68111
Mark checkpoint feature as Linux-only, and homogenize error messages
This patch adds annotations to mark the checkpoint commands as Linux only, which
hides them if the daemon is running a non-matching operating-system type;

Before:

    docker

    Usage:	docker COMMAND

    A self-sufficient runtime for containers

    ...

    Management Commands:
      config      Manage Docker configs
      container   Manage containers
      image       Manage images

After:

    docker

    Usage:	docker COMMAND

    A self-sufficient runtime for containers

    ...

    Management Commands:
      checkpoint  Manage checkpoints
      config      Manage Docker configs
      container   Manage containers
      image       Manage images

This change also prints errors when attempting to use checkpoint commands or
flags if the feature is not supported by the Daemon's operating system;

    $ docker checkpoint --help
    docker checkpoint is only supported on a Docker daemon running on linux, but the Docker daemon is running on windows

    $ docker checkpoint create --help
    docker checkpoint create is only supported on a Docker daemon running on linux, but the Docker daemon is running on windows

    $ docker checkpoint ls --help
    docker checkpoint ls is only supported on a Docker daemon running on linux, but the Docker daemon is running on windows

    $ docker checkpoint rm --help
    docker checkpoint rm is only supported on a Docker daemon running on linux, but the Docker daemon is running on windows

    $ docker container start --checkpoint=foo mycontainer
    "--checkpoint" requires the Docker daemon to run on linux, but the Docker daemon is running on windows

    $ docker container start --checkpoint-dir=/foo/bar mycontainer
    "--checkpoint-dir" requires the Docker daemon to run on linux, but the Docker daemon is running on windows

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-05-31 22:25:06 +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 a252cb1197 Fix outputting twice the docker stack rm error message
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2018-05-30 15:56:41 +02:00
Silvin Lubecki 66059a925b Fix always listing nodes during docker stack ps command on Kubernetes. A user without node listing rights could not use this command as it always fails.
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2018-05-30 15:28:35 +02:00
Zachary Romero b6cf6d87ae Add String method so quieted output displays properly
Fixes #1089

Signed-off-by: Zachary Romero <zacromero3@gmail.com>
2018-05-29 05:30:17 +03:00
Vincent Demeester 824a0b4db9
Merge pull request #1068 from silvin-lubecki/remove-experimental-for-orchestrator
Remove Kubernetes commands from experimental
2018-05-28 17:39:11 +02:00
Sebastiaan van Stijn d38f397da1
Validate stack-names for empty values
Add validation for stack names to prevent an empty name resulting in _all_
stacks to be returned after filtering, which can result in removal of services
for all stacks if `--prune`, or `docker stack rm` is used.

Before this change;

    docker stack deploy -c docker-compose.yml one
    docker stack deploy -c docker-compose.yml two
    docker stack deploy -c docker-compose.yml three

    docker stack deploy -c docker-compose.yml --prune ''
    Removing service one_web
    Removing service two_web
    Removing service three_web

After this change:

    docker stack deploy -c docker-compose.yml one
    docker stack deploy -c docker-compose.yml two
    docker stack deploy -c docker-compose.yml three

    docker stack deploy -c docker-compose.yml --prune ''
    invalid stack name: ""

Other stack commands were updated as well:

Before this change;

    docker stack deploy -c docker-compose.yml ''
    Creating network _default
    failed to create network _default: Error response from daemon: rpc error: code = InvalidArgument desc = name must be valid as a DNS name component

    docker stack ps ''
    nothing found in stack:

    docker stack rm ''
    Removing service one_web
    Removing service three_web
    Removing service two_web

After this change:

    docker stack deploy -c docker-compose.yml ''
    invalid stack name: ""

    docker stack ps ''
    invalid stack name: ""

    docker stack rm ''
    invalid stack name: ""

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-05-28 17:03:26 +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
Vincent Demeester 537e67d462
Merge pull request #1084 from thaJeztah/minor-code-refactor
Minor refactor in stack helper functions
2018-05-28 12:39:15 +02:00
Sebastiaan van Stijn 0c175fc21a
Minor refactor in stack helper functions
- Don't wrap the code to be slightly more readable
- Rename `getServiceFilter()` to `getStackServiceFilter()` to be
  consistent with other helper functions.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-05-28 12:26:14 +02:00
Vincent Demeester 82053236a3
Merge pull request #1059 from mat007/kubernetes-orchestrator-all-namespaces
Kubernetes orchestrator all namespaces
2018-05-28 11:59:54 +02:00
Mathieu Champlon 1c1300bef6 Imply all Kubernetes namespaces for docker stack list when orchestrator is all or Kubernetes
* Add "kubernetes" struct in config file with "allNamespaces" option, to opt-out this behavior when set as "disabled"

Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2018-05-28 10:43:32 +02:00
Simon Ferquel f38510b2d8 Better stack status check
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2018-05-25 12:56:52 +02:00
Sebastiaan van Stijn 0089f172b7
Merge pull request #1023 from simonferquel/k8s-stack-services-filters
[Kubernetes] stack services filters
2018-05-24 19:56:33 +02:00
Mathieu Champlon 297866ebbe Match Swarm in how to combine filters
`docker stack services --filter=label=foo=bar --filter=label=foo=baz my-stack` with Swarm gets handled as `filter on (a label named foo with value bar) AND (a label named foo with value baz).
This obviously yields an empty result set every time, but if and how this should be changed is out of scope here, so simply align Kubernetes with Swarm for now.

Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2018-05-24 15:24:23 +02:00
Sebastiaan van Stijn df9a0c7797
Minor refactor: use anyChanged() to detect changed flags
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-05-24 01:30:09 +02:00
Sebastiaan van Stijn df43eb931e
Fix cpu/memory limits and reservations being reset on service update
Before this change:
----------------------------------------------------

Create a service with reservations and limits for memory and cpu:

    docker service create --name test \
      --limit-memory=100M --limit-cpu=1 \
      --reserve-memory=100M --reserve-cpu=1 \
      nginx:alpine

Verify the configuration

    docker service inspect --format '{{json .Spec.TaskTemplate.Resources}}' test
    {
      "Limits": {
        "NanoCPUs": 1000000000,
        "MemoryBytes": 104857600
      },
      "Reservations": {
        "NanoCPUs": 1000000000,
        "MemoryBytes": 104857600
      }
    }

Update just CPU limit and reservation:

    docker service update --limit-cpu=2 --reserve-cpu=2 test

Notice that the memory limit and reservation is not preserved:

    docker service inspect --format '{{json .Spec.TaskTemplate.Resources}}' test
    {
      "Limits": {
        "NanoCPUs": 2000000000
      },
      "Reservations": {
        "NanoCPUs": 2000000000
      }
    }

Update just Memory limit and reservation:

    docker service update --limit-memory=200M --reserve-memory=200M test

Notice that the CPU limit and reservation is not preserved:

    docker service inspect --format '{{json .Spec.TaskTemplate.Resources}}' test
    {
      "Limits": {
        "MemoryBytes": 209715200
      },
      "Reservations": {
        "MemoryBytes": 209715200
      }
    }

After this change:
----------------------------------------------------

Create a service with reservations and limits for memory and cpu:

    docker service create --name test \
      --limit-memory=100M --limit-cpu=1 \
      --reserve-memory=100M --reserve-cpu=1 \
      nginx:alpine

Verify the configuration

    docker service inspect --format '{{json .Spec.TaskTemplate.Resources}}' test
    {
      "Limits": {
        "NanoCPUs": 1000000000,
        "MemoryBytes": 104857600
      },
      "Reservations": {
        "NanoCPUs": 1000000000,
        "MemoryBytes": 104857600
      }
    }

Update just CPU limit and reservation:

    docker service update --limit-cpu=2 --reserve-cpu=2 test

Confirm that the CPU limits/reservations are updated, but memory limit and reservation are preserved:

    docker service inspect --format '{{json .Spec.TaskTemplate.Resources}}' test
    {
      "Limits": {
        "NanoCPUs": 2000000000,
        "MemoryBytes": 104857600
      },
      "Reservations": {
        "NanoCPUs": 2000000000,
        "MemoryBytes": 104857600
      }
    }

Update just Memory limit and reservation:

    docker service update --limit-memory=200M --reserve-memory=200M test

Confirm that the Mempry limits/reservations are updated, but CPU limit and reservation are preserved:

    docker service inspect --format '{{json .Spec.TaskTemplate.Resources}}' test
    {
      "Limits": {
        "NanoCPUs": 2000000000,
        "MemoryBytes": 209715200
      },
      "Reservations": {
        "NanoCPUs": 2000000000,
        "MemoryBytes": 209715200
      }
    }

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-05-24 01:30:00 +02:00
Simon Ferquel 1f7aa1c036 Add filter support for stack ps and services with Kubernetes
Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2018-05-23 18:27:27 +02:00
Vincent Demeester cc6ff56fd5
Merge pull request #1035 from mat007/kubernetes-check-hosts-match
For docker stack ls make an error if Swarm and Kubernetes hosts do not match
2018-05-22 14:50:09 +02:00
Mathieu Champlon bfe9aed63a For docker stack ls make an error if Swarm and Kubernetes hosts do no match
Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2018-05-22 14:39:48 +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
Victor Vieux 7bdd820f28
Merge pull request #1054 from thaJeztah/fix-host-rm-being-too-greedy
Fix service update --host-rm not being granular enough
2018-05-21 15:21:06 -07:00
Sebastiaan van Stijn 9a89c32e9a
Merge pull request #1053 from justyntemme/patch-3
Change error message for unreadable files
2018-05-22 00:12:46 +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
Vincent Demeester b15c3cfec9
Merge pull request #1065 from thaJeztah/fix-kube-alignment
Fix component information alignment
2018-05-18 14:54:42 +02:00