Commit Graph

565 Commits

Author SHA1 Message Date
Kyle Spiers 4e797eaa04 docs: add docs for new trust subcommands
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-10-30 16:53:54 +01:00
Riyaz Faizullabhoy 604bc3f22d trust: key-load and key-generate code
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-10-30 16:53:53 +01:00
Ashwini Oruganti dde9f614a7 trust: add signer-add and signer-remove command
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-10-30 16:53:53 +01:00
Sebastiaan van Stijn dbdf8f6468
Preserve sort-order of extra hosts, and allow duplicate entries
Extra hosts (`extra_hosts` in compose-file, or `--hosts` in services) adds
custom host/ip mappings to the container's `/etc/hosts`.

The current implementation used a `map[string]string{}` as intermediate
storage, and sorted the results alphabetically when converting to a service-spec.

As a result, duplicate hosts were removed, and order of host/ip mappings was not
preserved (in case the compose-file used a list instead of a map).

According to the **host.conf(5)** man page (http://man7.org/linux/man-pages/man5/host.conf.5.html)

    multi  Valid values are on and off.  If set to on, the resolver
      library will return all valid addresses for a host that
      appears in the /etc/hosts file, instead of only the first.
      This is off by default, as it may cause a substantial
      performance loss at sites with large hosts files.

Multiple entries for a host are allowed, and even required for some situations,
for example, to add mappings for IPv4 and IPv6 addreses for a host, as illustrated
by the example hosts file in the **hosts(5)** man page (http://man7.org/linux/man-pages/man5/hosts.5.html):

    # The following lines are desirable for IPv4 capable hosts
    127.0.0.1       localhost

    # 127.0.1.1 is often used for the FQDN of the machine
    127.0.1.1       thishost.mydomain.org  thishost
    192.168.1.10    foo.mydomain.org       foo
    192.168.1.13    bar.mydomain.org       bar
    146.82.138.7    master.debian.org      master
    209.237.226.90  www.opensource.org

    # The following lines are desirable for IPv6 capable hosts
    ::1             localhost ip6-localhost ip6-loopback
    ff02::1         ip6-allnodes
    ff02::2         ip6-allrouters

This patch changes the intermediate storage format to use a `[]string`, and only
sorts entries if the input format in the compose file is a mapping. If the input
format is a list, the original sort-order is preserved.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-10-30 01:48:09 +01:00
Sebastiaan van Stijn 79b19cba16
Fix flag description for --host-add
The `--host-add` flag adds a new `host:ip` mapping. Even though
adding an entry is idempotent (adding the same mapping multiple
times does not update the service's definition), it does not
_update_  an existing mapping with a new IP-address (multiple
IP-addresses can be defined for a host).

This patch removes the "or update" part from the flag's
description.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-10-28 16:47:53 +02:00
Daniel Nephin 54e1378e04 Merge pull request #636 from dnephin/fix-trust-output-stream
Fix stdout and errors in image/trust
2017-10-27 11:31:01 -04:00
Sebastiaan van Stijn e4940cb8d2 Merge pull request #621 from charrywanganthony/displaystringutils
Refactor stringutils and fix docker search output form
2017-10-27 11:08:36 +02:00
Chao Wang 926b20fcb5 Refactor stringutils and fix docker search output form when the description has CJK character
Signed-off-by: Chao Wang <wangchao.fnst@cn.fujitsu.com>
2017-10-27 11:15:10 +08:00
Daniel Nephin c0d004f7cf Update gometalinter
and enable the new WarnUnmatchedDirective to warn if a nolint is unnecessary.
remove some unnecessary nolint

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-10-26 12:21:02 -04:00
Daniel Nephin 4205416c9b Update code for upstream cobra
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-10-25 14:49:26 -04:00
Riyaz Faizullabhoy 5ab3ae7aba trust: define new commands and helpers
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-10-24 11:23:35 +02:00
Daniel Nephin 8f86a25029 Fix stdout and errors in image/trust
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-10-23 13:54:55 -04:00
Sebastiaan van Stijn 1401d5daf2 Merge pull request #620 from dnephin/add-nakedret-linter
Add nakedret linter
2017-10-13 14:54:00 +02:00
Daniel Nephin dbd96badb6 Add nakedret linter.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-10-12 11:48:51 -04:00
Sebastiaan van Stijn e56a58e4ed
Updates for updated moby version
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-10-12 01:02:10 +02:00
Daniel Nephin e548861481 Refactor runPull to remove second GetImageReferencesAndAuth
Fix unit tests to catch the regression.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-10-10 16:32:27 -04:00
Riyaz Faizullabhoy 067fff8b03 trust: update references when pulling
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-10-10 11:19:02 -07:00
Brian Goff 1367fc1114 Merge pull request #593 from thaJeztah/add-create-output
Add output for "secrets" and "configs" on stack deploy
2017-10-03 11:06:04 -04:00
Sebastiaan van Stijn a5113f4368
Add output for "secrets" and "configs" on stack deploy
When deploying a stack from a compose file, the output did not show
that a secret or config was created. This patch adds messages for these.

Create a configuration file and compose file:

    $ cat > config.yml <<EOF
    hello: world
    EOF

    $ cat > secret.txt <<EOF
    p@ssw0rd
    EOF

    $ cat > docker-compose.yml <<EOF
    version: "3.3"
    services:
       test:
         image: nginx:alpine
         configs:
         - source: myconfig
           target: /my-config.yml
         secrets:
         - source: mysecret
           target: /my-secret.txt
    configs:
      myconfig:
        file: ./config.yml
    secrets:
      mysecret:
        file: ./secret.txt
    EOF

Before this patch is applied:

    $ docker stack deploy -c docker-compose.yml example
    Creating network example_default
    Creating service example_test

After this patch is applied:

    $ docker stack deploy -c docker-compose.yml example
    Creating network example_default
    Creating secret example_mysecret
    Creating config example_myconfig
    Creating service example_test

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-10-03 15:13:10 +02:00
Sebastiaan van Stijn 532a3942d6
Remove use of deprecated IsErr...NotFound checks
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-10-03 12:01:24 +02:00
Sebastiaan van Stijn e98e95e7bc
Improve presentation of published port ranges
Port mappings in `docker service ls` are quite verbose, and occupy a lot of
space when ranges of ports are published.

This patch improves the output by reconstructing ranges of ports.

Given the following service;

    $ docker service create \
      -p 60-61:60-61 \
      -p 62:61 \
      -p 80:80 \
      -p 81:80 \
      -p 90-95:90-95 \
      -p 90-92:90-92/udp \
      -p 93-96:93-96/udp \
      --name foo \
      nginx:alpine

Before this patch is applied:

    $ docker service ls
    ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
    u1kwguv841qg        foo                 replicated          1/1                 nginx:alpine        *:60->60/tcp,*:61->61/tcp,*:62->61/tcp,*:80->80/tcp,*:81->80/tcp,*:90->90/tcp,*:91->91/tcp,*:92->92/tcp,*:93->93/tcp,*:94->94/tcp,*:95->95/tcp,*:90->90/udp,*:91->91/udp,*:92->92/udp,*:93->93/udp,*:94->94/udp,*:95->95/udp,*:96->96/udp

After this patch is applied:

    $ docker service ls
    ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
    u1kwguv841qg        foo                 replicated          1/1                 nginx:alpine        *:60-62->60-61/tcp,*:80-81->80/tcp,*:90-95->90-95/tcp,*:90-96->90-96/udp

Additional enhancements can still be made, and marked as TODO in this change;

- combine non-consecutive ports mapped to a single port (`80->80`, `81->80`,
  `84->80`, `86->80`, `87->80`); to be printed as `*:80-81,84,86-87->80`.
- combine `tcp` and `udp` mappings if their port-mapping is the same;
  print `*:80-81->80-81/tcp+udp` instead of `*:80-81->80-81/tcp, *:80-81->80-81/udp`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-10-02 12:54:20 +02:00
Sebastiaan van Stijn c5f267d95c
Do not truncate ID on docker service ps --quiet
Running `docker service ps --quiet` should print the
full, non-truncated ID, even if the `--no-trunc` option
is not set.

This patch disables truncation if the `--quiet` flag
is set.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-09-30 22:23:37 +02:00
Stephen J Day e78772af4d
cli/command/container: ensure channel is allocated
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-09-29 18:12:03 -07:00
Sebastiaan van Stijn 0082310aa5
Fixes for updated dependencies
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-09-29 17:45:31 +02:00
Sebastiaan van Stijn e63417a9c0
Add --no-trunc option to docker container stats
This patch adds a `--no-trunc` option to `docker container stats`;

With this patch applied, the default output is:

    CONTAINER ID        NAME                                    CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
    b95a83497c91        awesome_brattain                        0.28%               5.629MiB / 1.952GiB   0.28%               916B / 0B           147kB / 0B          9
    67b2525d8ad1        foobar                                  0.00%               1.727MiB / 1.952GiB   0.09%               2.48kB / 0B         4.11MB / 0B         2
    e5c383697914        test-1951.1.kay7x1lh1twk9c0oig50sd5tr   0.00%               196KiB / 1.952GiB     0.01%               71.2kB / 0B         770kB / 0B          1
    4bda148efbc0        random.1.vnc8on831idyr42slu578u3cr      0.00%               1.672MiB / 1.952GiB   0.08%               110kB / 0B          578kB / 0B          2
    84e3deaa45b2        registry                                0.01%               3.402MiB / 1.952GiB   0.17%               127kB / 378B        233kB / 0B          10
    2ed915778ceb        foo.1.lsmxrefn5yp9c9ijz1hzgdq4u         0.00%               1.727MiB / 1.952GiB   0.09%               166kB / 7.76kB      614kB / 0B          2

Addin the `--no-trunc` option, changes the output to:

    CONTAINER ID                                                       NAME                                    CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
    b95a83497c9161c9b444e3d70e1a9dfba0c1840d41720e146a95a08ebf938afc   awesome_brattain                        0.25%               5.75MiB / 1.952GiB    0.29%               648B / 0B           147kB / 0B          10
    67b2525d8ad10bb236a49960e93c09993b0baabeef12c2d46cd5f4fbb6f4808c   foobar                                  0.00%               1.727MiB / 1.952GiB   0.09%               2.35kB / 0B         4.11MB / 0B         2
    e5c383697914b98b10cbbc9d0bd324b7b927099ac584f031057b8208d2fba9b1   test-1951.1.kay7x1lh1twk9c0oig50sd5tr   0.00%               196KiB / 1.952GiB     0.01%               71.1kB / 0B         770kB / 0B          1
    4bda148efbc006b0063373c3678083159af89f8cc83a6a28def14cb0dd171f70   random.1.vnc8on831idyr42slu578u3cr      0.00%               1.672MiB / 1.952GiB   0.08%               110kB / 0B          578kB / 0B          2
    84e3deaa45b2fc363e06167df9b90ab59f88d4f101e3f9b8df03a62a8f6783e1   registry                                0.00%               3.387MiB / 1.952GiB   0.17%               127kB / 378B        233kB / 0B          10
    2ed915778cebddf9ec69263a75cfdcf00962a5198d94d42cda75d5cd45bb82f2   foo.1.lsmxrefn5yp9c9ijz1hzgdq4u         0.00%               1.727MiB / 1.952GiB   0.09%               166kB / 7.76kB      614kB / 0B          2

Which is the same as the default before this patch was applied.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-09-27 18:59:25 +02:00
Sebastiaan van Stijn 0a78472211
Update default output format for stats to include ID and Name
The `docker container stats` output has a column (`CONTAINER`), that shows either
the container _id_ or container _name_, depending on the arguments given.

For example, running `docker container stats foobar` shows:

    CONTAINER           CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
    foobar              0.00%               1.938MiB / 1.952GiB   0.10%               782B / 0B           4.11MB / 0B         2

Whereas `docker container stats 67b2525d8ad1` (`67b2525d8ad1` being the ID for
container `foobar`) shows:

    CONTAINER           CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
    67b2525d8ad1        0.00%               1.938MiB / 1.952GiB   0.10%               916B / 0B           4.11MB / 0B         2

This behavior is confusing.

This patch updates the default output format for `docker stats` to use separate
columns for container ID and container Name (similar to `docker container ls`).

With this patch applied, both commands show the same output:

    $ docker container stats foobar
    CONTAINER ID                                                       NAME                CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
    67b2525d8ad10bb236a49960e93c09993b0baabeef12c2d46cd5f4fbb6f4808c   foobar              0.00%               1.938MiB / 1.952GiB   0.10%               1.25kB / 0B         4.11MB / 0B         2

    $ docker container stats 67b2525d8ad1
    CONTAINER ID                                                       NAME                CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
    67b2525d8ad10bb236a49960e93c09993b0baabeef12c2d46cd5f4fbb6f4808c   foobar              0.00%               1.938MiB / 1.952GiB   0.10%               1.31kB / 0B         4.11MB / 0B         2

Users that want to use the old format can configure a custom format in the
cli configuration file (`~/.docker/config.json`);

on Linux:

    {
      "statsFormat" : "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.PIDs}}"
    }

on Windows:

    {
      "statsFormat" : "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}"
    }

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-09-27 18:05:51 +02:00
Vincent Demeester feb4d79935 Merge pull request #562 from dnephin/update-gometalinter
Update gometalinter
2017-09-27 09:42:37 +02:00
Riyaz Faizullabhoy 9ad0e8f223 trust: remove extraneous OPTIONS from commands that do not use it
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-09-26 16:15:45 -07:00
Daniel Nephin 4203b49431 Refactor image commands to make use of the new trust struct for trusted pull
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-26 15:15:42 -04:00
Daniel Nephin d956386b2d Update gometalinter
The update includes bug fixes in gometalinter and updates to linters, which
discovered more linter problems.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-26 12:33:35 -04:00
Sebastiaan van Stijn 0856c20e04 Merge pull request #551 from dnephin/set-local-constant
Use a local constant
2017-09-26 17:42:50 +02:00
Riyaz Faizullabhoy e07f345267 mark command as experimental in docs and cli
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-09-25 09:39:46 -07:00
Riyaz Faizullabhoy c6db0cd7a1 trust: rename inspect to view, add repo name to signer table header
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-09-25 09:39:46 -07:00
Riyaz Faizullabhoy 46a879e3b9 tests: use alice/bob/claire conventional names for signers
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-09-25 09:39:46 -07:00
Riyaz Faizullabhoy 4e95fcd72c trust: update remove to error on empty references for consistency
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-09-25 09:39:46 -07:00
Riyaz Faizullabhoy 67cf09cbe1 tests: move trust test to proper package
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-09-25 09:39:46 -07:00
Riyaz Faizullabhoy 4e89dc800a trust: update reference type and use golden output
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-09-25 09:39:44 -07:00
Riyaz Faizullabhoy 6fca400f1e tests: address review feedback
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-09-25 09:38:41 -07:00
Riyaz Faizullabhoy f667bd7559 trust: use mock CLI for testing offline
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-09-25 09:38:40 -07:00
Riyaz Faizullabhoy e5c35ab9d1 cli: introduce NotaryClient getter
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-09-25 09:38:38 -07:00
Riyaz Faizullabhoy 7c5b836ca5 trust: add Repository client interface
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-09-25 09:34:54 -07:00
Riyaz Faizullabhoy 45c102a03d trust: address review feedback, refactor to align with existing cli/command semantics
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-09-25 09:34:53 -07:00
Riyaz Faizullabhoy 609f8b4b81 trust revoke: add docker trust revoke command
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-09-25 09:34:53 -07:00
Riyaz Faizullabhoy fab6bb6798 trust sign: add docker trust sign command
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-09-25 09:34:53 -07:00
Riyaz Faizullabhoy ec6bc9460f trust inspect: add docker trust inspect command with formatting print
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-09-25 09:34:52 -07:00
Riyaz Faizullabhoy 5846e6e5d5 trust: update existing code for new vendoring, refactor for docker trust code sharing
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-09-25 09:34:52 -07:00
allencloud 26f06c5bcb sort secrets and configs in cli
Signed-off-by: Allen Sun <shlallen1990@gmail.com>
2017-09-25 13:18:13 +08:00
Daniel Nephin 32612058cb Use a local constant
This constant is going to be removed from jsonlog package.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-22 17:59:46 -04:00
Daniel Nephin e828efa4ab Set APIVersion on the client, even when Ping fails
Refactor to support testing
Also add tests

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-22 10:08:19 -04:00
Sebastiaan van Stijn 3edf97e5a9 Merge pull request #366 from twistlock/plugable_secrets_backend
Plugable secrets backend
2017-09-18 19:25:15 +02:00
Daniel Nephin 7b77ab5c60 Merge pull request #513 from shouze/reset-id-pair-during-build-to-avoid-cache-busting
Reset uid/gid to 0 in build context to fix cache busting issues on ADD/COPY
2017-09-13 15:19:26 -04:00
Sebastiaan van Stijn 0c27355f7b
Use non-detached mode as default for service commands
Commit 330a0035334871d92207b583c1c36d52a244753f added a `--detach=false` option
to various service-related commands, with the intent to make this the default in
a future version (17.09).

This patch changes the default to use "interactive" (non-detached), allowing
users to override this by setting the `--detach` option.

To prevent problems when connecting to older daemon versions (17.05 and below,
see commit db60f25561), the detach option is
ignored for those versions, and detach is always true.

Before this change, a warning was printed to announce the upcoming default:

    $ docker service create nginx:alpine
    saxiyn3pe559d753730zr0xer
    Since --detach=false was not specified, tasks will be created in the background.
    In a future release, --detach=false will become the default.

After this change, no warning is printed, but `--detach` is disabled;

    $ docker service create nginx:alpine
    y9jujwzozi0hwgj5yaadzliq6
    overall progress: 1 out of 1 tasks
    1/1: running   [==================================================>]
    verify: Service converged

Setting the `--detach` flag makes the cli use the pre-17.06 behavior:

    $ docker service create --detach nginx:alpine
    280hjnzy0wzje5o56gr22a46n

Running against a 17.03 daemon, without specifying the `--detach` flag;

    $ docker service create nginx:alpine
    kqheg7ogj0kszoa34g4p73i8q

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-09-13 12:27:55 +02:00
Sébastien HOUZÉ 7e407610d4
Reset idPair during build to avoid cache busting
Signed-off-by: Sébastien HOUZÉ <cto@verylastroom.com>
2017-09-13 02:04:03 +02:00
Sebastiaan van Stijn 6f1b510843
Refactor/cleanup of docker info
Some mild refactoring of the docker info command;

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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-09-11 15:13:06 +02:00
Victor Vieux aae519d0f6 Merge pull request #510 from dnephin/add-parse-log-details
Use a local copy of ParseLogDetails
2017-09-08 11:38:24 -07:00
Daniel Nephin 51587de1c4 Use golden files for tests that expect end-of-line whitespace
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-07 17:50:44 -04:00
Daniel Nephin a747389bf4 Use a local copy of ParseLogDetails
It's being removed from client/

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-07 12:50:25 -04:00
Liron Levin 0ee9e05d8f Plugable secret backend
This commit extends SwarmKit secret management with pluggable secret
backends support.
Following previous commits:
1. docker/swarmkit@eebac27434
2. docker/docker@08f7cf0526
Added driver parameter to `docker secret` command.

Specifically:

1. `docker secret create [secret_name] --driver [driver_name]`
2.  Displaying the driver in
```
    $ docker secret ls
    $ docker secret inspect [secret_name]
    $ docker secret inspect [secret_name] -pretty
```

Signed-off-by: Liron Levin <liron@twistlock.com>
2017-09-07 11:10:44 +03:00
Daniel Nephin 5c5cdd0e36 Merge pull request #424 from simonferquel/update-vendoring
updated vendoring
2017-09-05 15:06:09 -04:00
Daniel Nephin ec99774a85 Merge pull request #406 from ksouf/issue_37_network_list_test
adding network list test
2017-09-05 11:24:32 -04:00
Simon Ferquel a0113c3a44 updated vendoring
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2017-09-01 19:41:06 -04:00
French Ben bb8f49773c Move output of stack rm to stdout
Signed-off-by: French Ben <frenchben@docker.com>

Update for the test to capture the proper removal

Signed-off-by: French Ben <frenchben@docker.com>

Satisfy lint length limit

Signed-off-by: French Ben <frenchben@docker.com>

Updated e2e test

Signed-off-by: French Ben <frenchben@docker.com>
2017-09-01 14:25:20 -07:00
Daniel Nephin d817967647 Merge pull request #489 from dnephin/fix-container-run
Fix crash in container run after pulling an image
2017-08-31 18:11:26 -04:00
Daniel Nephin 5a9bf7f359 Merge pull request #484 from ripcurld0/ps_exit_1
When nothing found in stack exit with exit code 1
2017-08-31 17:13:00 -04:00
Daniel Nephin a0d8d80250 Fix crash in containe run after pulling an image.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-31 17:08:02 -04:00
Boaz Shuster 79f9af2475 When nothing found in stack exit with exit code 1
To keep on a consistent behaviour such as in docker-service-ps
if docker-stack-ps didn't find a given stack, the command line
should exit with exit code 1.

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
2017-08-30 23:25:36 +03:00
Victor Vieux 8ea02f6f08 Merge pull request #477 from dnephin/some-tests-for-container-command
A few tests for container command
2017-08-30 09:38:38 -07:00
Daniel Nephin e7f90b6b38 Reduce complexity in cli/command/container
Add tests for exec and cleanup existing tests.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-29 19:25:50 -04:00
Daniel Nephin dae1b7112c Remove test for code not in this repo.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-29 13:19:28 -04:00
khaled souf 15d92a9e03 adding network list test
Signed-off-by: khaled souf <khaled.souf@gmail.com>
2017-08-29 16:30:37 +02:00
Daniel Nephin d318c4112b Reduce complexity of two formatters
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-28 12:49:07 -04:00
Vincent Demeester 7e52344cd2 Merge pull request #471 from cyli/surface-autolock
Include whether the managers in the swarm are autolocked as part of `docker info`
2017-08-28 17:46:09 +02:00
Ying Li 3428b78e96 Include whether the managers in the swarm are autolocked as part of `docker info`.
Signed-off-by: Ying Li <ying.li@docker.com>
2017-08-25 16:33:46 -07:00
Vincent Demeester 8ebc03a71f Merge pull request #367 from kolyshkin/ipcmode
Introduce/document new IPC modes
2017-08-25 09:48:00 +02:00
Tibor Vass 6c3d93bbb6 Merge pull request #445 from dnephin/add-end-to-end-suite
Add end to end suite
2017-08-23 16:16:09 -07:00
Daniel Nephin 05308fcec7 Merge pull request #440 from ripcurld0/search_format
Add --format to docker-search
2017-08-22 19:10:53 -04:00
Victor Vieux 5e1d0289f4 Merge pull request #456 from dnephin/add-tests-for-client
Add unit tests for initializing the client
2017-08-22 16:08:36 -07:00
Boaz Shuster 88cc47ad5c Add --format to docker-search
Signed-off-by: Jeremy Chambers <jeremy@thehipbot.com>
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
2017-08-23 01:37:54 +03:00
Daniel Nephin 79ecfa876b Merge pull request #463 from dnephin/remove-pkg-testutil
Remove docker/docker/pkg/testutil
2017-08-22 13:53:03 -04:00
Marco Mariani 3a0b967c05 support --compose-file - as stdin
Signed-off-by: Marco Mariani <marco.mariani@alterway.fr>
2017-08-22 17:55:59 +02:00
Vincent Demeester 317b735573 Merge pull request #439 from ripcurld0/fix_image_ls_digest
Show images digests when "{{.Digest}}" is in format
2017-08-22 16:17:43 +02:00
Daniel Nephin 846a31aa50 Use new internal testutil.ErrorContains()
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-22 10:14:25 -04:00
Daniel Nephin b3f843afe2 Move internal/test package out of cli.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-22 10:14:25 -04:00
Boaz Shuster 83112f6343 Show images digests when "{{.Digest}}" is in format
This patch fixes the following bug:

Running "docker image ls --digests" will add images digests
to the image table. However, when using "format" to display
images digests all of them are "<none>".

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
2017-08-22 16:55:10 +03:00
Vincent Demeester 8da1daeefa Merge pull request #386 from thaJeztah/fix-image-resolve-detection
Fix image resolve detection
2017-08-22 15:05:39 +02:00
Christophe Vidal 037029414d Dropped hyphen in bind mount where appropriate
Signed-off-by: Christophe Vidal <kriss@krizalys.com>
2017-08-19 21:14:48 +07:00
Sebastiaan van Stijn 3c7ede6a68 Merge pull request #205 from redpanda/rollback
Add 'docker service rollback' subcommand
2017-08-19 15:56:14 +02:00
Daniel Nephin 930f97dd09 Add unit tests for initializing the client.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-18 12:49:23 -04:00
Jimmy Leger 11d471d660 Add 'docker service rollback' subcommand
Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Implement runRollback to not use runUpdate

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Add version tag and add flag quiet to suppress progress output

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Removed flags from warnDetachDefault

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Used command.Cli interface

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Add detach flag on rollback command

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Create a fakeClient for service commands

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Added unit test for rollback command

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Used command.Cli interface instead of *command.DockerCli in service commands

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Revert "Removed flags from warnDetachDefault"

This reverts commit 3e4f601c8a82cc2599a755dc693409bbc47917fc.

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Fixed test.NewFakeCli instanciation

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Removed unused receiver

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Replaced cli by dockerCli

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Revert "Removed unused receiver"

This reverts commit 604ef7c13df3d019949ca81d992db501114dafce.

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Fixed last typo

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>
2017-08-16 22:18:36 +02:00
Daniel Nephin 15837afa77 Replace pkg/testutil/tempfile with gotestyourself/fs
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-16 14:23:28 -04:00
Daniel Nephin 505a0fe45f Update volume command tests to use the new golden
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-16 14:23:28 -04:00
Daniel Nephin 3d68aa8416 Update swarm command tests to use the new golden
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-16 14:23:28 -04:00
Daniel Nephin 1dd742eac8 Update stack and task command tests to new golden
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-16 14:23:28 -04:00
Daniel Nephin 4c62d7288f Update service and secret command tests to new golden
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-16 14:23:28 -04:00
Daniel Nephin 0e2bf7420a Update node command tests to the new golden
Also remove some superfluous tests that are now covered by a strict golden.Assert

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-16 14:23:15 -04:00
Daniel Nephin 75f7bfedf8 Update image command tests to use the new golden
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-16 14:20:36 -04:00
Daniel Nephin f9007ad7db Update config and checkpoint commands to use gotestyourself/golden
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-16 14:19:00 -04:00
Daniel Nephin b5cb5ee446 Add first e2e test
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-16 10:46:40 -04:00
Daniel Nephin 3b8cf20a0c Merge pull request #436 from thaJeztah/improve-singular-plural-message
Singularize / pluralize "argument(s)" in error message
2017-08-14 11:06:25 -04:00
Sebastiaan van Stijn 898f1e2997 Merge pull request #438 from ripcurld0/history_fix
Print timestamp when --human=true
2017-08-14 16:02:04 +02:00
Vincent Demeester aaf6939679 Merge pull request #390 from thaJeztah/add-test-for-github-special-case
Add test for github.com special handling
2017-08-14 10:24:13 +02:00
Boaz Shuster 5e7f0f67a8 Print timestamp when --human=true
* Setting "--human=true" changes "CreatedSince" format

* "CreatedAt" now displays the creation timestamp as
  specified in the documents

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
2017-08-12 23:12:47 +03:00
Sebastiaan van Stijn b9a7f35e02
Singularize / pluralize "argument(s)" in error message
The validation functions to test for the number of passed arguments did not
pluralize `argument(s)`, and used `argument(s)` in all cases.

This patch adds a simple `pluralize()` helper to improve this.

Before this change, `argument(s)` was used in all cases:

    $ docker container ls foobar
    "docker container ls" accepts no argument(s).

    $ docker network create one two
    "docker network create" requires exactly 1 argument(s).

    $ docker network connect
    "docker network connect" requires exactly 2 argument(s).

    $ docker volume create one two
    "docker volume create" requires at most 1 argument(s).

After this change, `argument(s)` is properly singularized or plurarized:

    $ docker container ls foobar
    "docker container ls" accepts no arguments.

    $ docker network create one two
    "docker network create" requires exactly 1 argument.

    $ docker network connect
    "docker network connect" requires exactly 2 arguments.

    $ docker volume create one two
    "docker volume create" requires at most 1 argument.

Test cases were updated accordingly.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-08-12 18:25:38 +02:00
Daniel Nephin f3c325f390 Merge pull request #427 from vdemeester/import-templates-from-docker-pkg
Import templates from docker pkg
2017-08-08 11:55:58 -04:00
Vincent Demeester a6800f95fa
Import `docker/docker/pkg/templates` to cli
This package will be deprecated/removed from `docker/docker/pkg` and
is mainly used for the cli format options. Let's import it and
maintain here.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-08-08 17:26:24 +02:00
Kir Kolyshkin 9285db6752 Introduce/document new IPC modes
This builds (and depends) on https://github.com/moby/moby/pull/34087

Version 2:
 - remove --ipc argument validation (it is now done by daemon)
 - add/document 'none' value
 - docs/reference/run.md: add a table with better modes description
 - dockerd(8) typesetting fixes

Version 3:
 - remove ipc mode tests from cli/command/container/opts_test.go

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2017-08-05 17:49:53 -07:00
Sebastiaan van Stijn d0bea64185
Preserve resolved image-digest if QueryRegistry == false
When re-deploying a stack without re-resolving the image digest,
the service's ContainerSpec was updated with the image-reference
as specified in the stack/compose file.

As a result, the image-digest that was resolved in a previous
deploy was overwritten, causing the service to be re-deployed.

This patch preserves the previously resolve image-digest
by copying it from the current service spec.

A unit test is also added to verify that the image information
in the service spec is not updated if QueryRegistry is disabled.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-08-03 18:49:07 +02:00
Sebastiaan van Stijn f007d623a8
Add test for github.com special handling
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-08-03 17:53:42 +02:00
Josh Hawn 2831a04cba Enable TCP Keep-Alive in Docker client
Some network environments may have NATs, proxies, or gateways which
kill idle connections. There are many Docker API operations which may
be idle for long periods of time (such as ContainerWait and ContainerAttach)
and may result in unexpected connection closures or hangs if TCP keepalives
are not used.

This patch updates the default HTTP transport used by the Docker client
package to enable TCP Keep-Alive with a keep-alive interval of 30 seconds.
It also sets a connect timeout of 30 seconds.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2017-08-02 14:35:03 -07:00
Sebastiaan van Stijn ceb18a841a
Fix presentation of published "random" host ports
Ports that were picked from the ephemeral port range
were presented as `*:0->80/tcp`.

This patch changes the presentation to use the
actually assigned port, instead of the port specified
in `Endpoint.Spec` (which is always empty/zero (`0`))

Before this change;

    ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
    5d44i665qj66        with-random-port    replicated          1/1                 nginx:alpine        *:0->80/tcp

After this change;

    ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
    5d44i665qj66        with-random-port    replicated          1/1                 nginx:alpine        *:30000->80/tcp

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-08-01 19:21:17 +02:00
Darren Stahl 18c877d35c Fast fail when save directory does not exist
Signed-off-by: Darren Stahl <darst@microsoft.com>
2017-07-27 15:00:38 -07:00
Sebastiaan van Stijn 3c095dc546
Error if "until" filter is combined with "--volumes" on system prune
The "until" filter is supported by all object types, except for
volumes.

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

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

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

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

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

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

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

    $ docker volume prune --filter until=24h

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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-21 12:11:53 +02:00
Vincent Demeester 36b9edff7e Merge pull request #364 from ksouf/issue-37-add-connect-disconnect
adding connect disconnect network tests
2017-07-21 11:19:23 +02:00
Sebastiaan van Stijn dfbad2bc5a Merge pull request #357 from ripcurld0/nat_sort_service
Sort services names in a natural order
2017-07-20 22:56:09 +02:00
khaled souf 7296abf39f adding connect disconnect network tests
Signed-off-by: khaled souf <khaled.souf@gmail.com>
2017-07-20 18:53:03 +02:00
Daniel Nephin 60991e943b Add myself to command/stack codeowners
Cleanup a test

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-07-20 12:05:20 -04:00
Alex Mavrogiannis 7f53c99dfe Skip inspects of built-in networks on stack deploy
Signed-off-by: Alex Mavrogiannis <alex.mavrogiannis@docker.com>
2017-07-19 19:39:44 -07:00
Boaz Shuster 7478e47b2d Sort services names in a natural order
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
2017-07-19 18:18:06 +03:00
Daniel Nephin ff350a04cb Remove unnecessary prune function aliases.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-07-18 12:25:45 -04:00
Vincent Demeester a14762c6d2 Merge pull request #350 from thaJeztah/unexport-commands
Unexport subcommands
2017-07-18 17:17:01 +02:00
Sebastiaan van Stijn 9c7b0d74cd
Unexport subcommands
These commands were only used as subcommands, so did
not have to be exported.

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

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

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-07-18 09:49:02 +02:00
Sebastiaan van Stijn 6c3a448ecb
Fix: skip build-cache prune on unsupported versions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-17 11:55:35 +02:00
Boaz Shuster 1333b49194 Sort swarm stacks and nodes using natural sorting
This commit changes the order stacks and nodes are displayed.
For example, running "docker stack ls" is expected to
display the following list:

NAME          SERVICES
service-1     1
service-2     1
service-10    1

However, currently this is what is printed:

NAME          SERVICES
service-1     1
service-10    1
service-2     1

To fix this, "docker stack ls" and "docker node ls" are using
natural sorting to make it more human readable.

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
2017-07-13 14:33:02 +03:00
Sebastiaan van Stijn ae38f202bb Merge pull request #271 from tych0/password-stdin
Password stdin
2017-07-12 17:08:11 -07:00
Ying Li 4615c92f66 Fix warning in docker CLI when `swarm ca --ca-cert`, etc. flags are passed,
and add a test.

Signed-off-by: Ying Li <ying.li@docker.com>
2017-07-12 14:56:28 -07:00
Daniel Nephin f27934376d Fix test and lint failures
Split test cases.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-07-12 11:37:35 -04:00
Vincent Demeester 87345ed117 Merge pull request #277 from thaJeztah/dont-remove-what-isnt-there
Don't attempt to remove unsupported resources on older daemon
2017-07-12 10:43:54 +02:00
Vincent Demeester fa7687a362 Merge pull request #299 from dnephin/less-verbose-fake-cli
Less verbose fake cli
2017-07-12 09:56:43 +02:00
Daniel Nephin 42a3800783 Update some tests to remove unnecessary buffers.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-07-11 17:52:43 -04:00
Daniel Nephin 3da0cbfdd1 Remove unnecessary use of SetConfigfile
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-07-11 14:49:30 -04:00
Daniel Nephin 69b142b52a Update FakeCli to remove duplication in tests.
Use byte buffers by default, since that is what is done most of the time.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-07-11 14:49:30 -04:00
Daniel Nephin 102a8f0c9d Pin all tools used in the Dockerfiles
Also update gometalinter to use the official version. The update
found some new gosimple errors, which are fixed.

Also update the filewatcher script for the latest version of filewatcher.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-07-11 14:23:27 -04:00
Tycho Andersen 7d18477bc2 login: add a --password-stdin argument
This:

* conflicts with --password (naturally)
* conflicts with the absence of --username (both can't be grabbed by the
  stdin)
* strips a trailing newline off the password if it exists

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2017-07-11 12:16:29 -06:00
Sebastiaan van Stijn 2429f15672
Don't attempt to remove unsupported resources on older daemon
When running `docker stack rm <some stack>` against an older daemon,
a warning was printed for "configs" being ignored;

    WARNING: ignoring "configs" (requires API version 1.30, but the Docker daemon API version is 1.26)

Given that an old daemon cannot _have_ configs, there should not be
a need to warn, or _attempt_ to remove these resources.

This patch removes the warning, and skips fetching (and removing)
configs.

A check if _secrets_ are supported by the daemon is also added,
given that this would result in an error when attempted against
an older (pre 1.13) daemon.

There is one situation where this could lead to secrets or
configs being left behind; if the client is connecting to a
daemon that _does_ support secrets, configs, but the API version
is overridden using `DOCKER_API_VERSION`, no warning is printed,
and secrets and configs are not attempted to be removed.

Given that `DOCKER_API_VERSION` is regarded a feature for
debugging / "power users", it should be ok to ignore this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-11 10:29:03 -07:00
Sebastiaan van Stijn d8a2972cb1 Remove unused prune functions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-10 13:27:19 -07:00
Vincent Demeester af6c0896f5 Merge pull request #298 from dnephin/fix-stack-out-stream
Fix stack output stream
2017-07-10 09:23:23 +02:00
Sebastiaan van Stijn 7ae9bc141c Merge pull request #259 from aaronlehmann/service-progress-surface-error
progress: Show task error in place of progress bar
2017-07-09 00:04:38 -07:00
Sebastiaan van Stijn c99530b1d2 Merge pull request #270 from tych0/warn-only-about-password-on-cli
login: print a big warning when using --password
2017-07-08 16:37:40 -07:00
Aaron Lehmann c9b92a328d progress: Light refactor
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-07-06 10:40:35 -07:00
Yassine TIJANI 45b0e7cf1a fixing SIGSEGV when running containers
Signed-off-by: Yassine TIJANI <yasstij11@gmail.com>

moving the deffering of the close after the error checking

Signed-off-by: Yassine TIJANI <yasstij11@gmail.com>

fixing SIGSEGV when running containers

Signed-off-by: Yassine TIJANI <yasstij11@gmail.com>
2017-07-06 18:57:36 +02:00
Vincent Demeester 1aa82bc7df Merge pull request #211 from ksouf/issue-37-add-tests-on-commands
adding network_create tests
2017-07-06 08:59:15 +02:00
Aaron Lehmann e672589ec0 Merge pull request #296 from thaJeztah/fix-error-overwrite
Fix error variable being overwritten
2017-07-05 19:26:27 -07:00
khaled souf 57c1551991 adding unit tests to network
Signed-off-by: khaled souf <khaled.souf@gmail.com>
2017-07-06 00:54:30 +02:00
Sebastiaan van Stijn 4d4c789cac
Fix error variable being overwritten
The `err` variable was set in a loop, so only
the last result was taken into account to return
"failure" or not.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-05 13:54:57 -07:00
Daniel Nephin 0030bfea9f Remove duplication in task formatting.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-07-05 13:40:47 -04:00
Daniel Nephin fb6deb1077 Fix stream for 'nothing found in stack' message
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-07-05 13:32:54 -04:00
Sebastiaan van Stijn e8080dd7e5
update tests for new image struct
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-04 20:34:24 -07:00
Daniel Nephin 3554d02f33 Merge pull request #276 from adshmh/add-unit-tests-to-checkpoint-package
add unit tests to checkpoint package
2017-07-04 11:17:25 -04:00
Victor Vieux 43fb4a4547 Merge pull request #243 from vieux/scale2
add `--detach` to docker scale
2017-07-04 16:36:59 +02:00
Vincent Demeester 85b41c3e71 Merge pull request #213 from dnephin/improve-swarm-ca-cmd
Refactor and UI changes to `swarm ca` command
2017-07-03 17:02:45 +02:00
Tycho Andersen c269ad26e8 login: print a big warning when using --password
Task command lines are world readable via /proc/pid/cmdline, so this isn't
safe.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2017-07-03 08:47:20 -06:00
Victor Vieux 58d3fc24b1 scale all services at once
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-07-03 13:40:54 +02:00
Arash Deshmeh b296abd542 add unit tests to cli/command/checkpoint package
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2017-06-30 17:17:47 -04:00
Daniel Nephin 379b762495 Merge pull request #273 from adshmh/add-unit-tests-to-task-package
add unit tests to task package
2017-06-30 11:41:24 -04:00
Arash Deshmeh 244e28f41f add unit tests to task package
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2017-06-29 17:57:31 -04:00
Daniel Nephin 81e9837859 Refactor caCommand
Split out a swarmCAOptions struct for options that are shared between
the ca and update commands.

Change the 'no trust root' message to an error.

Add some unit tests.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-29 17:57:06 -04:00
Daniel Nephin a04aa8fe28 Compress after rewriting the archive.
Write a test showing compress failure.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-29 13:18:10 -04:00
Vincent Demeester 74af31be7f Merge pull request #227 from dnephin/expose-config
expose config credentials without needing the Cli
2017-06-29 19:11:37 +02:00
Harald Albers 849b0e96a0 system prune: only warn about volumes if --volumes is given
Signed-off-by: Harald Albers <github@albersweb.de>
2017-06-29 15:07:21 +02:00
Aaron Lehmann dd3eae84e1 progress: Add unit tests
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-06-28 17:53:56 -07:00
Aaron Lehmann 1ef585f65d progress: Show task error in place of progress bar
If a task encounters an error, the interactive "service create" and
"service update" commands should show that error instead of showing a
stuck progress bar.

To validate:

docker service create --detach=false --name broken --restart-condition=none --replicas 3 busybox asdf
and
docker service create --detach=false --name broken --mode global --restart-condition none busybox asdf

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-06-27 15:12:31 -07:00
Aaron Lehmann 82e069026b progress: Show success message when finished counting down
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-06-27 15:07:10 -07:00
Victor Vieux 6c6b1091d9 add --detach to docker scale
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-06-27 09:55:10 -07:00
Vincent Demeester 105b21d1ab
Rename NewConfigFile to New in configfile package
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-06-27 16:31:38 +02:00
Daniel Nephin a3cbc70147
Move credential getting functions to the ConfigFile.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-27 13:46:47 +02:00
Daniel Nephin a8c70e43a3
Move config file loading to more appropriate packages.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-27 13:45:50 +02:00
Sebastiaan van Stijn cfff0e2259 Merge pull request #207 from cyli/warn-swarm-ca-command
If `docker swarm ca` is not called with the `--rotate` flag, warn if other flags are passed
2017-06-26 20:56:54 -07:00
Victor Vieux db60f25561 hide --detach for docker < 17.05
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-06-26 18:55:30 -07:00
Victor Vieux 0133e13353 Merge pull request #231 from tonistiigi/client-session-fssession
Incrementally sending build context
2017-06-26 17:15:34 -07:00
Sebastiaan van Stijn 2f58992f85 Merge pull request #237 from aaronlehmann/progress-before-assignment
progress: Show progress of replicated tasks before they are assigned
2017-06-26 17:14:07 -07:00
Tonis Tiigi b95638a5ac Use long running session in builder
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>

Add incremental context send support

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-06-26 16:30:01 -07:00
Sebastiaan van Stijn 298d486d8b Merge pull request #235 from vdemeester/234-fix-warn
Add a line break after warning 👼
2017-06-24 02:17:26 -07:00
Aaron Lehmann d3d09f67b1 progress: Show progress of replicated tasks before they are assigned
This was only showing tasks that belong to nodes that are currently up,
so that tasks on down nodes don't appear to be stuck. But this
unintentionally excludes tasks that haven't been assigned yet, so if a
task is stuck before assignment, for example because no nodes meet its
constraints, a progress bar won't even be shown. The check should only
apply to tasks that have a node assignment.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-06-23 17:34:59 -07:00
Tonis Tiigi ae8d049f9e fix build issue with updated moby
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-06-23 16:12:20 -07:00
Daniel Nephin 8b6196ded7 Merge pull request #236 from vdemeester/import-displayable-ports-from-moby
Import DisplayablePorts from moby/moby source
2017-06-23 15:01:53 -04:00
Daniel Nephin c60d13e539 Fix cyclomatic complexity of two formatters
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-23 11:34:22 -07:00
Vincent Demeester b7fad8f1dc
Add a line break after warning 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-06-23 20:15:00 +02:00
Vincent Demeester 9e142cadc9
Import DisplayablePorts from moby/moby source
This has nothing to do in the `api` package for moby as it's just a
cli display function.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-06-23 20:12:30 +02:00
Vincent Demeester 0c6b8d717d Merge pull request #221 from dnephin/fix-lint-errors
Fix lint errors merged while new lint branch was in PR
2017-06-23 09:54:12 +02:00
Sebastiaan van Stijn aefbc9d8f7 Merge pull request #202 from ripcurld0/fix_32235_moby
Unmarshal a number as a Number in RawInspectFallback
2017-06-22 23:12:50 -07:00
Daniel Nephin 732261f774 Use compose volume spec parser for container volume flag
Restore testcases for Volume spec parsing.
And correctly interpret the parsed volume.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-21 11:16:04 -04:00
Boaz Shuster 9a2f2d769d Unmarshal a number as a Number in RawInspectFallback
Running `docker inspect --format "{{.ID}} {{.Size}}" alpine` prints
sha256:651aa95985aa4a17a38ffcf71f598ec461924ca96865facc2c5782ef2d2be07f 3983636
While `docker inspect --format "{{.Id}} {{.Size}}" alpine` prints
sha256:651aa95985aa4a17a38ffcf71f598ec461924ca96865facc2c5782ef2d2be07f 3.983636e+06

This happens because "Id" is not a field of types.ImageInspect and thus
tryRawInspectFallback is called and converts the raw response into `interface{}`
using a JSON decoder. However, by default that decoder converts numbers into
`float64` unless `UseNumber` is set.

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
2017-06-21 13:10:14 +03:00
Vincent Demeester d5d0ec56c1 Merge pull request #214 from adshmh/add-unit-tests-to-stack-package
add unit tests to stack package
2017-06-21 10:00:08 +02:00
Daniel Nephin b84e21cd05 Fix lint errors merged while new lint branch was in PR.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-21 00:11:59 -04:00
Ying Li 32b43bc21a If `docker swarm ca` is not called with the `--rotate` flag, the other
flags, including cert expiry, will be ignored, so warn if a user attempts
to use `docker swarm ca --cert-expiry` or something.

Signed-off-by: Ying Li <ying.li@docker.com>
2017-06-20 18:55:10 -07:00
Brian Goff 2bfac7fcda Merge pull request #176 from dnephin/new-lint
New linters
2017-06-20 16:47:45 -07:00
Brian Goff 760f847bc8 Merge pull request #195 from Zebrilee/fix-issue-114
fix the issue `--help` doesn't work if daemon is not available
2017-06-20 16:38:36 -07:00
Arash Deshmeh 535af2d868 add unit tests to stack package
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2017-06-20 14:31:00 -04:00
Dave Tucker 35f1e301b5 Allow Proxy Configuration in config.json
This commit modifies config.json to allow for any proxies allowed in
build-args to be configured. These values will then be used
by default as build-args in docker build.

Signed-off-by: Dave Tucker <dt@docker.com>
2017-06-20 09:51:41 +01:00
zebrilee cca30cb1d9 comment the return of setHelpFunc in order to show --help even if the daemon is not running. Then add a if statement in isSupported function to check if the daemon is running
Signed-off-by: zebrilee <zebrilee@gmail.com>

revert change on docker.go, set HasExperimental to true in cli.go

Signed-off-by: zebrilee <zebrilee@gmail.com>
2017-06-16 10:24:26 +02:00
Arash Deshmeh 7f71d0d979 removed logging from command/formatter package tests
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2017-06-15 14:14:59 -04:00
Daniel Nephin 3724fb7f37 Add gosimple lint
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-14 16:55:08 -07:00
Daniel Nephin 3e3934c19f Add unparam linter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-14 16:55:08 -07:00
Daniel Nephin 3bf0317fea Add unconvert linter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-14 16:54:27 -07:00
Daniel Nephin a712993e93 Add misspell lint
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-14 16:54:27 -07:00
Daniel Nephin 01e1e58ada Add unused linter.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-14 16:54:27 -07:00
Daniel Nephin 759e59e4a4 Merge pull request #182 from vdemeester/180-fix-stack-rm-config-endpoint
Do not call the config endpoint if API is lower than 1.30
2017-06-14 14:31:01 -04:00
Arash Deshmeh 751278abe6 removed logging from service/inspect test to clean up the output of running tests
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2017-06-14 12:38:31 -04:00
Vincent Demeester d209929aab Merge pull request #187 from dnephin/small-cleanup-to-image-remove
Fix some problems with image force remove
2017-06-14 09:59:32 +02:00
Vincent Demeester 4ffefe4a1f Merge pull request #115 from jsoref/spelling
Spelling
2017-06-14 09:58:55 +02:00
Vincent Demeester 2128b3f112
Do not call the config endpoint if API is lower than 1.30
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-06-14 09:56:53 +02:00
Aaron Lehmann 275c488734 Merge pull request #72 from thaJeztah/fix-prefix-matching
Fix prefix-matching for service ps
2017-06-13 14:59:37 -07:00
Aaron Lehmann 25bc9f1ce7 Merge pull request #184 from yongtang/167-network-inspect-scope
Use scope=swarm for service related network inspect and revendor docker/docker
2017-06-13 14:47:20 -07:00
Yong Tang 657457ee2c Use `scope=swarm` for service related network inspect.
This fix use `scope=swarm` for service related network inspect.
The purpose is that, in case multiple networks with the same
name exist in different scopes, it is still possible to obtain
the network for services.

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

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-06-13 20:26:12 +00:00
Daniel Nephin 676b71eaaa Fix some problems with image remove force.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-13 12:12:54 -07:00
Arash Deshmeh 006b9b126d fixed the output leak from error test case for config/remove
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2017-06-13 12:24:42 -04:00
Vincent Demeester dd924ebf4f
Fix remove_test output duplication
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-06-13 14:02:56 +02:00
Vincent Demeester ecc8e0a204 Merge pull request #160 from e11137/master
fixes #46 Always exit 0 when remove image with force option
2017-06-13 14:02:02 +02:00
Vincent Demeester dd585ad4fb Merge pull request #172 from adshmh/fix-secret-remove-testcase-error-message-leak
fixed the output leak from the error test case for secret/remove command
2017-06-09 21:03:33 +02:00
Arash Deshmeh 77062a09dc fixed the output leak from secret/remove command error test case
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2017-06-09 13:21:14 -04:00
Arash Deshmeh 852bf0f96d removed the output leaked from stack remove error test case
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2017-06-09 12:14:18 -04:00
Victor Vieux a74e715b1a Merge pull request #166 from thaJeztah/update-term
Bump docker/docker to cd35e4beee13a7c193e2a89008cd87d38fcd0161
2017-06-08 13:45:32 -07:00
Aaron Lehmann 4d980880f3 Merge pull request #121 from nishanttotla/digest-pinning-stack-deploy
Enable client side digest pinning for stack deploy
2017-06-08 23:20:02 +03:00
Daniel Nephin 0310de5213 Move IsArchive and HeaderSize to build/context
Previously these were in docker/docker/pkg/archive, but unused

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-08 16:08:11 -04:00
Rogelio Canedo 5c8d702af5 Always exit whith -1 when remove image with force option
Signed-off-by: Rogelio Canedo <rcanedo@mappy.priv>
2017-06-08 20:15:37 +02:00
Sebastiaan van Stijn ab3ea637b6 Merge pull request #111 from keloyang/attach-restarting-check
Add a restarting check to runAttach
2017-06-08 12:53:15 +02:00
Shukui Yang 90f497302f Add a restarting check to runAttach
Signed-off-by: Shukui Yang <yangshukui@huawei.com>
2017-06-08 07:12:39 +08:00
Shukui Yang e8cc2cf760 Replace command.DockerCli to command.Cli in docker attach/exec command
Signed-off-by: Shukui Yang <yangshukui@huawei.com>
2017-06-08 07:03:52 +08:00
Nishant Totla f790e839fc
Change --no-resolve-image flag to --resolve-image string flag
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
2017-06-07 12:30:11 -07:00
Nishant Totla 9f1bea2657
Enable client side digest pinning for stack deploy
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
2017-06-07 12:30:11 -07:00
Kenfe-Mickaël Laventure 08cb0bddfd Merge pull request #162 from vdemeester/150-configs-fixes-on-old-daemon
Handle case of configs on old daemon
2017-06-07 12:18:32 -07:00
Aaron Lehmann 9d12d6fc87 Merge pull request #145 from dnephin/improve-compose-secrets-errors
Compose: Improve error messages when resource create/update fails
2017-06-07 18:51:10 +03:00
Vincent Demeester cf5550c426
Handle case of configs on old daemon
If configs are declared for a service and pointing on an old
daemon, error out properly (instead of "page not found").

If there is no configs declared, don't call convertServiceConfigObjs
to avoid having an error.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-06-07 17:02:46 +02:00
Vincent Demeester 44ac80881f
Update vendoring of docker/docker
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-06-06 00:23:21 +02:00
Daniel Nephin 3718833f2c Add unit tests for service/ps
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-02 11:29:19 -04:00
Sebastiaan van Stijn a0066a150b Merge pull request #143 from thaJeztah/remove-email-flag
Remove deprecated -e/--email flag from docker login
2017-06-02 08:56:07 +02:00
Daniel Nephin 729d07a371 Compose: Improve error messages when resource creation/updates fail.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-01 15:03:04 -04:00
Daniel Nephin b5baffde44 Fix complexity of service/ps.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-01 11:49:16 -04:00
Sebastiaan van Stijn f10f29df8d
Allow --detach and --quiet flags when using --rollback
Commit 78c204ef79 added
(f9bd8ec8b268581f93095c5a80679f0a8ff498bf in the moby repo)
a validation to prevent `--rollback` from being used
in combination with other flags that update the
service spec.

This validation was not taking into account that
some flags only affect the CLI behavior, and
are okay to be used when rolling back.

This patch updates the validation, and adds
`--quiet` and `--detach` to the list of allowed
flags.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-06-01 16:31:07 +02:00
Sebastiaan van Stijn 8b383d2351
Remove deprecated -e/--email flag from docker login
The `docker login -e` / `docker login --email` option was deprecated in
Docker 1.11 (https://github.com/moby/moby/releases/tag/v1.11.0) through
aee260d4eb3aa0fc86ee5038010b7bbc24512ae5 (April 2016), and when used has
been outputing a deprecation warning since;

    Flag --email has been deprecated, will be removed in 17.06.

Originally this option was scheduled to be removed in docker 1.13, but
extended to docker 17.06 due to a change in our deprecation policy.

Given that only docker 1.10 and older use this flag (which is EOL, including
for CS versions, as of February 2017), will now be removed.

With this patch, `docker login` will now produce an Error if the flag
is used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-06-01 12:55:04 +02:00
Vincent Demeester efaadcf465 Merge pull request #132 from mavenugo/stack-host
Host and Bridge network support in docker stack deploy
2017-05-31 15:07:56 -07:00
Sebastiaan van Stijn 6279612443
Fix prefix-matching for service ps
The docker CLI matches objects either by ID _prefix_
or a full name match, but not partial name matches.

The correct order of resolution is;

- Full ID match (a name should not be able to mask an ID)
- Full name
- ID-prefix

This patch changes the way services are matched.

Also change to use the first matching service, if there's a
full match (by ID or Name) instead of continue looking for
other possible matches.

Error handling changed;

- Do not error early if multiple services were requested
  and one or more services were not found. Print the
  services that were not found after printing those that
  _were_ found instead
- Print an error if ID-prefix matching is ambiguous

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-05-31 21:43:56 +02:00
Kenfe-Mickaël Laventure f3cb13c550 Merge pull request #118 from cpuguy83/no_prune_volume
Don't prune volumes on `docker system prune`
2017-05-30 10:21:15 -07:00
Brian Goff 37fd6128dc Don't prune volumes on `docker system prune`
Volumes tend to carry important data and pruning them on `docker system
prune` can easily cause unwanted data loss.

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

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-05-30 12:50:30 -04:00
John Stephens f05cd11ee2
Remove stack configs on stack removal
Signed-off-by: John Stephens <johnstep@docker.com>
2017-05-26 18:17:43 -07:00
Marcus Martins 862649707e
Handle a Docker daemon without registry info
The current implementation of the ElectAuthServer doesn't handle well when the
default Registry server is not included in the response from the daemon Info
endpoint.

That leads to the storage and usage of the credentials for the default registry
(`https://index.docker.io/v1/`) under an empty string on the client config file.

Sample config file after a login via a Docker Daemon without Registry
information:
```json
{
	"auths": {
		"": {
			"auth": "***"
		}
	}
}
```

That can lead to duplication of the password for the default registry and
authentication failures against the default registry if a pull/push is performed
without first authenticating via the misbehaving daemon.

Also, changes the output of the warning message from stdout to sdterr as
per dnephin suggestion.

Signed-off-by: Marcus Martins <marcus@docker.com>
2017-05-26 14:46:39 -07:00
Daniel Nephin 341703d21e Add tests for verifyExternalNetwork
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-26 12:21:04 -04:00
Madhu Venugopal 123f0bfd98 With the introduction of node-local network support, docker services can
be attached to special networks such as host and bridge. This fix brings
in the required changes to make sure the stack file accepts these
networks as well.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2017-05-25 19:50:08 -07:00
Sebastiaan van Stijn 61c0b9f78d Merge pull request #102 from keloyang/attach-block
Recheck the container's state to avoid attach block.
2017-05-24 12:09:38 +01:00
Josh Soref 70a9905ee5 Spelling fixes
* appropriate
* assumption
* attach
* because
* building
* customized
* mapping
* propagated

Signed-off-by: Josh Soref <jsoref@gmail.com>
2017-05-22 01:39:06 +00:00
Shukui Yang f9dc3337f9 Recheck the container's state to avoid attach block.
If use docker attach command to attach to a stop container, it will return
"You cannot attach to a stopped container" error, it's ok, but when
attach to a running container, it(docker attach) use inspect to check
the container's state, if it pass the state check on the client side,
and then the container is stopped, docker attach command still attach to
the container and not exit.

Signed-off-by: Shukui Yang <yangshukui@huawei.com>
2017-05-20 08:02:06 +08:00
Sebastiaan van Stijn eea4a38cd6 Merge pull request #77 from vdemeester/move-duration-opts
Move duration opts into an opts package
2017-05-18 11:15:30 +02:00
Abhinandan Prativadi 40341ae089 Adding network options to service create/update
Changes added to accept network specific options in
docker service create/update

Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2017-05-17 21:07:48 -07:00
Madhu Venugopal d156151ba1 Merge pull request #49 from aboch/nlo2
Add network create flags --scope, --config-only, --config-from
2017-05-17 20:08:23 -07:00
Sebastiaan van Stijn 74cc280521 Merge pull request #30 from nishanttotla/rename-trust-function
Moving docker service digest pinning to client side
2017-05-18 03:05:48 +02:00
Nishant Totla 39d03bb2bd
Adding a flag to allow disabling registry lookup
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
2017-05-17 17:55:11 -07:00
Nishant Totla c61ea6f789
Service create/update set QueryRegistry appropriately
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
2017-05-17 17:39:35 -07:00
Alessandro Boch b5e43fb5ec Add support for config-only, config-from and scope options
- To promote a network to swarm mode

Signed-off-by: Alessandro Boch <aboch@docker.com>
2017-05-17 17:17:50 -07:00
Sebastiaan van Stijn 85c2330dfa Merge pull request #80 from AkihiroSuda/adjust-docker-stats
[Carry moby/moby#32777] Adjusted docker stats memory output
2017-05-18 01:55:52 +02:00
Sebastiaan van Stijn b3e7e1ff74 Merge pull request #101 from jlhawn/update_container_wait
Update `run` and `start` to use container wait API
2017-05-18 01:31:40 +02:00
Josh Hawn 6eca53c7ae Refactor holdHijackedConnection
It has been refactored to a hijackedIOStreamer type which has several
methods which are used to prepare input and handle streaming the input
and output separately.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2017-05-17 15:18:01 -07:00
Gaetan de Villele 1cc1f54d90 make system prune “--filter” flag available only for docker 17.04 (api v1.28) and newer
Signed-off-by: Gaetan de Villele <gdevillele@gmail.com>
2017-05-17 12:36:09 -07:00
Josh Hawn 38591f20d0 Update CLI package with containerWait changes
The docker/client package was updated to support the updated Container
Wait API functionality. The run and start commands have been updated to
use the new wait features.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2017-05-17 11:44:54 -07:00
Brian Goff ae1124abad Merge pull request #42 from dperny/service-logs-support-details
Add support for details on service logs
2017-05-17 10:15:55 -04:00
Vincent Demeester dee8e6ab2d Merge pull request #95 from dnephin/use-check-redirect
Use CheckRedirect so that client behaves the same way with GO 1.8
2017-05-17 10:13:42 +02:00
Drew Erny ebc0eff478 Add support for details on service logs
Adds CLI and client support for details on service logs. CLI component
of moby/moby#32996.

Signed-off-by: Drew Erny <drew.erny@docker.com>
2017-05-16 16:53:58 -07:00
Sebastiaan van Stijn 5b19f39017 Merge pull request #89 from aaronlehmann/pretty
Add --pretty option to "secret inspect" and "config inspect"
2017-05-17 01:38:10 +02:00
Aaron Lehmann 62567078ff Add --pretty option to "secret inspect" and "config inspect"
This adds a pretty template for both inspect subcommands. For configs,
it's particularly useful because it's a way to expose the config payload
in the CLI in a non-base64-encoded way.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-05-16 15:12:20 -07:00
Aaron Lehmann c17acee8cf Merge pull request #48 from cyli/root-rotation-cli
Synchronous CLI command for root CA rotation
2017-05-16 14:58:05 -07:00
Sebastiaan van Stijn ebbab14224 Merge pull request #98 from aaronlehmann/logs-padding-underflow
service: Avoid underflow in logs padding calculation
2017-05-16 23:36:25 +02:00
Aaron Lehmann 51f698337d Avoid loop when discarding contents of progress pipe
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-05-16 14:34:59 -07:00
Ying Li 3fe8321d0c Provide command line tool to view and rotate swarm's currently CA root certificate.
Signed-off-by: Ying Li <ying.li@docker.com>
2017-05-16 14:31:15 -07:00
Brian Goff e574286ba2 Add support for configs to compose format
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-05-16 17:10:14 -04:00
Aaron Lehmann ab6bc5dce6 service: Avoid underflow in logs padding calculation
This command inserts a variable amount of padding in the log line:

    padding := strings.Repeat(" ", f.padding-getMaxLength(task.Slot))

If the service is scaled up, or the slot numbers are noncontiguous, the
subtraction can underflow, causing a crash.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-05-16 12:27:31 -07:00
Vincent Demeester b5182ba17f
Move duration opts into an opts package
They have nothing to do with service and could be used on their own.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-05-16 17:49:40 +02:00
Daniel Nephin f9ab6a77b0 Use CheckRedirect so that client behaves the same way with GO 1.8
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-16 11:48:00 -04:00
Akihiro Suda 3c78bc775c Fix float64 comparison in stats_helpers_test.go
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-05-16 02:13:00 +00:00
Sergey Tryuber 82600b7021 Adjusted docker stats memory output
Signed-off-by: Sergey Tryuber <Sergeant007@users.noreply.github.com>
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-05-16 02:00:47 +00:00
Vincent Demeester d7f6563efc
Update cli imports to using local package
Also, rename a bunch of variable to not *shadow* the `opts` package
name.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-05-15 14:45:19 +02:00
Aaron Lehmann 35c8732dc9 Merge pull request #44 from cyli/root-ca-info-in-cli
Swarm cluster and node TLS info in CLI
2017-05-12 17:19:23 -07:00
Aaron Lehmann db5620026d Add support for configs
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-05-11 13:42:49 -07:00
cyli b75858eb09 Propagate the swarm cluster and node TLS info provided by the REST API
responses to the CLI. In `node ls`, display only whether the nodes' TLS
info matches the cluster's TLS info, or whether the node needs cert rotation.

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

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-05-09 14:22:51 -07:00
Aleksa Sarai ee7a956c54
client: check tty before creating exec job
This is necessary in order to avoid execId leaks in the case where a
`docker exec -it` is run without a terminal available for the client.
You can reproduce this issue by running the following command many
times.

  % nohup docker exec -it some_container true

The container `some_container` will have execIDs that will never
normally be cleaned up (because the client died before they were
started).

In addition, this patch adds a docker-inspect step to ensure that we
give "container does not exist" errors consistently.

Signed-off-by: Valentin Rothberg <vrothberg@suse.com>
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-05-09 21:07:40 +10:00
Daniel Nephin c31d25653f Add line length linter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-08 15:57:56 -04:00
Daniel Nephin 37ccc00d0e Add interfacer linter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-08 15:57:50 -04:00
Derek McGowan 515d0fd842 Remove unused trust key
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-05-08 11:49:40 -07:00
Gaetan de Villele 295140edf2 cli: gofmt + goimports
Signed-off-by: Gaetan de Villele <gdevillele@gmail.com>
2017-05-08 10:51:30 -07:00
Tibor Vass 57230a7212 rm client and vendor it instead
Signed-off-by: Tibor Vass <tibor@docker.com>
2017-05-08 10:33:56 -07:00
Ian Campbell c3648a9c94 Add `docker build --iidfile=FILE`
This is synonymous with `docker run --cidfile=FILE` and writes the digest of
the newly built image to the named file. This is intended to be used by build
systems which want to avoid tagging (perhaps because they are in CI or
otherwise want to avoid fixed names which can clash) by enabling e.g. Makefile
constructs like:

    image.id: Dockerfile
    	docker build --iidfile=image.id .

    do-some-more-stuff: image.id
    	do-stuff-with <image.id

Currently the only way to achieve this is to use `docker build -q` and capture
the stdout, but at the expense of losing the build output.

In non-silent mode (without `-q`) with API >= v1.29 the caller will now see a
`JSONMessage` with the `Aux` field containing a `types.BuildResult` in the
output stream for each image/layer produced during the build, with the final
one being the end product.  Having all of the intermediate images might be
interesting in some cases.

In silent mode (with `-q`) there is no change, on success the only output will
be the resulting image digest as it was previosuly.

There was no wrapper to just output an Aux section without enclosing it in a
Progress, so add one here.

Added some tests to integration cli tests.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-05-05 12:12:36 -07:00
Tibor Vass 03a36f9d50 Fix expected output in test due to linter-induced change on error string
Signed-off-by: Tibor Vass <tibor@docker.com>
2017-05-03 19:26:45 -07:00
Daniel Nephin 779012af69 Refacator pkg/streamformatter
StreamFormatter suffered was two distinct structs mixed into a single struct
without any overlap.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-03 18:49:14 -07:00
yupengzte 9ca78094b5 delete ineffectual assignment
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
2017-05-03 18:49:14 -07:00
Flavio Crisciani 169160ba63 Inroduce SWARM --data-path-addr flag
This new flag will allow the configuration of an interface that
can be used for data path traffic to be isolated from control
plane traffic. This flag is simply percolated down to libnetwork
and will be used by all the global scope drivers (today overlay)

Negative test added for invalid flag arguments

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2017-05-03 18:45:48 -07:00
Ying Li 81f87595fe Add the CACert parameter to the ExternalCA object in order to match
swarmkit's API type.  Make sure this parameter gets propagated to
swarmkit, and also add an extra option to the CLI when providing
external CAs to parse the CA cert from a file.

Signed-off-by: Ying Li <ying.li@docker.com>
2017-05-03 18:45:48 -07:00
Evan Hazlett 6665c9c747 remove service runtime filter in stack command
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-05-03 18:45:48 -07:00
Aaron Lehmann 6f94ab98f5 cli: Correct command/image tests for testify
These tests were caught in the crossfire of the transition to testify.
testify has a few subtle differences from the similar custom framework
it replaced:

- Error behaves differently
- Equal takes its arguments in a different order

This PR also takes the opportunity to use a few shorthands from testify,
such as Len, True, and False.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-05-03 18:45:48 -07:00
Evan Hazlett 25809f8991 move service runtime filter to server
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-05-03 18:44:11 -07:00
Vincent Demeester c67589a52c Fix docker run -it on windows
Signed-off-by: Vincent Demeester <vincent@demeester.fr>
2017-05-03 18:41:19 -07:00
Boaz Shuster 5b6bd92862 Add format to docker stack ls
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
2017-05-03 18:41:19 -07:00
Ignacio Capurro e7793092a2 Unit tests for cli/commands/image (except build and tag)
Signed-off-by: Ignacio Capurro <icapurrofagian@gmail.com>
2017-05-03 18:40:22 -07:00
Dave Henderson 2b31a4bf8d Output `docker swarm join` on a single line
This avoids issues when copy/pasting between different shells on
different OSes, which may not all support `\` as a continuation
character.

Fixes #32725

Signed-off-by: Dave Henderson <dhenderson@gmail.com>
2017-05-03 17:46:41 -07:00
Daniel Nephin a1b7969bce Set Composefile WorkingDir to dirname of the composefile.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-03 17:46:40 -07:00
Dong Chen a316b380e7 do not allow duration less than 1 ms in healthcheck parameters
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2017-05-03 17:46:40 -07:00
Brian Goff c44e74e676 Add logdrivers to /info
This is required for swarmkit to be able to filter based on log driver.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-05-03 17:46:39 -07:00