Commit Graph

7288 Commits

Author SHA1 Message Date
Silvin Lubecki 897293c7c7
Merge pull request #3007 from thaJeztah/20.10_backport_fix_yaml_formatting
[20.10 backport] docs: remove trailing spaces to prevent yamldocs using "compact" notation
2021-03-11 15:54:15 +01:00
Sebastiaan van Stijn 2c04354315
docs: remove trailing spaces to prevent yamldocs using "compact" notation
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e05e66f4b4)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-03-11 15:38:52 +01:00
Silvin Lubecki 9c8a91d22b
Merge pull request #3002 from thaJeztah/20.10_backport_remove_all_example
[20.10 backport] docs: improve example for "remove all stopped containers"
2021-03-09 21:07:18 +01:00
Sebastiaan van Stijn ff945151ef
docs: improve example for "remove all stopped containers"
recommend using `docker container prune`, but show an example on
how to combine commands with a bit more context and warnings
about portability/compatibility.

Thanks to Charlie Arehart to do the initial work on this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit d051df9943)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-03-09 18:24:25 +01:00
Tibor Vass 55c4c88966
Merge pull request #2987 from thaJeztah/20.10_revert_backport_ignore_sigurg
[20.10] Revert "Ignore SIGURG on Linux."
2021-03-02 09:58:58 -08:00
Sebastiaan van Stijn f33a69f6ee
[20.10] Revert "Ignore SIGURG on Linux."
This reverts commit 3c87f01b18.

This commit introduced two regressions;

- spurious "Unsupported signal: <nil>. Discarding."
- docker start --attach hanging if the container does not
  have a TTY attached

Reverting for now, while we dug deeper into what's causing
the regression.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-03-01 20:56:18 +01:00
Silvin Lubecki d3cb89ee53
Merge pull request #2957 from thaJeztah/20.10_backport_docs_fixes
[20.10 backport] documentation and completion-script fixes
2021-02-18 12:03:39 +01:00
Silvin Lubecki 433014bcfb
Merge pull request #2959 from thaJeztah/20.10_backport_fix_login_panic
[20.10 backport] Fix panic when failing to get DefaultAuthConfig
2021-02-18 12:02:41 +01:00
Silvin Lubecki 61cb016851
Merge pull request #2961 from thaJeztah/20.10_backport_fix_context_dockerfile_from_stdin_with_buildkit
[20.10 backport] Fix reading context and dockerfile from stdin with BuildKit
2021-02-18 12:02:09 +01:00
Silvin Lubecki 53c4602909
Merge pull request #2962 from thaJeztah/20.10_backport_go_md2man_binary_name
[20.10 backport] Rename bin/md2man to bin/go-md2man
2021-02-18 11:58:57 +01:00
Silvin Lubecki 830d6595e7
Merge pull request #2963 from thaJeztah/20.10_backport_fix_update_rollback_order
[20.10 backport] fix --update-order and --rollback-order flags
2021-02-18 11:58:23 +01:00
Silvin Lubecki 13048444cc
Merge pull request #2964 from thaJeztah/20.10_backport_fix_swarm_rollback_exitcode
[20.10 backport] Fix swarm rollback exitcode, and fix skipping verify step
2021-02-18 11:55:40 +01:00
Silvin Lubecki 3e293e6bd1
Merge pull request #2958 from thaJeztah/20.10_backport_fix_homedir_warning
[20.10 backport] cli/config: prevent warning if HOME is not set
2021-02-12 10:27:24 +01:00
Brian Goff 41b3ea7e47
Merge pull request #2960 from thaJeztah/20.10_backport_ignore_sigurg 2021-02-04 07:36:47 -08:00
Sebastiaan van Stijn d6eeeb6259
service rollback: always verify state
Prior to this change, progressbars would sometimes be hidden, and the function
would return early. In addition, the direction of the progressbars would sometimes
be "incrementing" (similar to "docker service update"), and sometimes be "decrementing"
(to indicate a "rollback" is being performed).

This fix makes sure that we always proceed with the "verifying" step, and now
prints a message _after_ the verifying stage was completed;

    $ docker service rollback foo
    foo
    overall progress: rolling back update: 5 out of 5 tasks
    1/5: running   [>                                                  ]
    2/5: starting  [===========>                                       ]
    3/5: starting  [===========>                                       ]
    4/5: running   [>                                                  ]
    5/5: running   [>                                                  ]
    verify: Service converged
    rollback: rollback completed

    $ docker service rollback foo
    foo
    overall progress: rolling back update: 1 out of 1 tasks
    1/1: running   [>                                                  ]
    verify: Service converged
    rollback: rollback completed

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 104469be0b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:55:51 +01:00
Sebastiaan van Stijn 3e157d5293
docker service rollback: fix non-zero exit code in some cases
Before this change:
--------------------------------------------

    $ docker service create --replicas=1 --name foo -p 8080:80 nginx:alpine
    t33qvykv8y0zbz266rxynsbo3
    overall progress: 1 out of 1 tasks
    1/1: running   [==================================================>]
    verify: Service converged

    $ echo $?
    0

    $ docker service update --replicas=5 foo
    foo
    overall progress: 5 out of 5 tasks
    1/5: running   [==================================================>]
    2/5: running   [==================================================>]
    3/5: running   [==================================================>]
    4/5: running   [==================================================>]
    5/5: running   [==================================================>]
    verify: Service converged

    $ echo $?
    0

    $ docker service rollback foo
    foo
    rollback: manually requested rollback
    overall progress: rolling back update: 1 out of 1 tasks
    1/1: running   [>                                                  ]
    verify: Service converged

    $ echo $?
    0

    $ docker service rollback foo
    foo
    service rolled back: rollback completed

    $ echo $?
    1

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

    $ docker service create --replicas=1 --name foo -p 8080:80 nginx:alpine
    t33qvykv8y0zbz266rxynsbo3
    overall progress: 1 out of 1 tasks
    1/1: running   [==================================================>]
    verify: Service converged

    $ echo $?
    0

    $ docker service update --replicas=5 foo
    foo
    overall progress: 5 out of 5 tasks
    1/5: running   [==================================================>]
    2/5: running   [==================================================>]
    3/5: running   [==================================================>]
    4/5: running   [==================================================>]
    5/5: running   [==================================================>]
    verify: Waiting 1 seconds to verify that tasks are stable...

    $ echo $?
    0

    $ docker service rollback foo
    foo
    rollback: manually requested rollback
    overall progress: rolling back update: 1 out of 1 tasks
    1/1: running   [>                                                  ]
    verify: Service converged

    $ echo $?
    0

    $ docker service rollback foo
    foo
    service rolled back: rollback completed

    $ echo $?
    0

    $ docker service ps foo
    ID             NAME      IMAGE          NODE             DESIRED STATE   CURRENT STATE           ERROR     PORTS
    4dt4ms4c5qfb   foo.1     nginx:alpine   docker-desktop   Running         Running 2 minutes ago

Remaining issues with reconciliation
--------------------------------------------

Note that both before, and after this change, the command sometimes terminates
early, and does not wait for the service to reconcile; this is most apparent
when rolling back is scaling up (so more tasks are deployed);

    $ docker service rollback foo
    foo
    service rolled back: rollback completed

    $ docker service rollback foo
    foo
    rollback: manually requested rollback
    overall progress: rolling back update: 1 out of 5 tasks
    1/5: pending   [=================================>                 ]
    2/5: running   [>                                                  ]
    3/5: pending   [=================================>                 ]
    4/5: pending   [=================================>                 ]
    5/5: pending   [=================================>                 ]
    service rolled back: rollback completed

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit ce26a165b0)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:55:49 +01:00
Jim Lin 1fdf84b8e9
fix --update-order and --rollback-order flags
Signed-off-by: Jim Lin <b04705003@ntu.edu.tw>
(cherry picked from commit 26a6a724aa)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:53:34 +01:00
Arnaud Rebillout 376b99c6d6
Rename bin/md2man to bin/go-md2man
In the recent PR !2877, some code was added to check if md2man is
already installed in the build environment. This is to cater to the
needs of Linux distributions.

However it turns out that Linux distributions install md2man as
bin/go-md2man instead of bin/md2man, hence the PR !2877 doesn't help
much.

This commit fixes it by settling on using the binary name go-md2man.

For reference, here the file list of the package go-md2man in several
distributions:

- Debian: <https://packages.debian.org/sid/amd64/go-md2man/filelist>
- Ubuntu: <https://packages.ubuntu.com/hirsute/amd64/go-md2man/filelist>
- Fedora: <https://fedora.pkgs.org/31/fedora-x86_64/golang-github-cpuguy83-md2man-2.0.0-0.4.20190624gitf79a8a8.fc31.x86_64.rpm.html>
- ArchLinux: <https://www.archlinux.org/packages/community/x86_64/go-md2man/>

Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>
(cherry picked from commit 6e2607c6a6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:50:45 +01:00
Alexey Igrychev 0de4e6e9a7
Fix reading context and dockerfile from stdin with BuildKit
Signed-off-by: Alexey Igrychev <alexey.igrychev@flant.com>
(cherry picked from commit fc9ca9a94a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:48:19 +01:00
Brian Goff 3c87f01b18
Ignore SIGURG on Linux.
In go1.14+, SIGURG is used by the runtime to handle preemtable system
calls.
In practice this signal caught *frequently*.

For reference:

https://go.googlesource.com/proposal/+/master/design/24543-non-cooperative-preemption.md
https://github.com/golang/go/issues/37942

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit fff164c22e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:44:39 +01:00
Sebastiaan van Stijn de40c2b172
Fix panic when failing to get DefaultAuthConfig
Commit f32731f902 fixed a potential panic
when an error was returned while trying to get existing credentials.

However, other code paths currently use the result of `GetDefaultAuthConfig()`
even in an error condition; this resulted in a panic, because a `nil` was
returned.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit c2820a7e3b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:42:06 +01:00
Sebastiaan van Stijn d513e46bfc
cli/config: prevent warning if HOME is not set
commit c2626a8270 replaced the use of
github.com/docker/docker/pkg/homedir with Golang's os.UserHomeDir().

This change was partially reverted in 7a279af43d
to account for situations where `$HOME` is not set.

In  situations where no configuration file is present in `~/.config/`, the CLI
falls back to looking for the (deprecated) `~/.dockercfg` configuration file,
which was still using `os.UserHomeDir()`, which produces an error/warning if
`$HOME` is not set.

This patch introduces a helper function and a global variable to get the user's
home-directory. The global variable is used to prevent repeatedly looking up
the user's information (which, depending on the setup can be a costly operation).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit c85a37dbb4)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:38:27 +01:00
Sebastiaan van Stijn 2b74b90efb
Add docs and completion for docker node ls --filter node.label
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit f52a9e2fef)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:33:15 +01:00
Sebastiaan van Stijn 05343b36a2
fix docker-run man page table formatting
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit c0b7b58134)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:33:10 +01:00
DongGeon Lee f90db254d7
docs: Fix wrong variable name
Signed-off-by: LeeDongGeon <secmatth1996@gmail.com>
(cherry picked from commit 852fe05991)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:33:06 +01:00
Christopher Svensson 0dcfdde336
Removed format flag for inspect
Signed-off-by: Christopher Svensson <stoffus@stoffus.com>
(cherry picked from commit b04241d95a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:33:01 +01:00
Christopher Svensson 03cd1dc50a
Added zsh completion for docker context subcommands
Signed-off-by: Christopher Svensson <stoffus@stoffus.com>
(cherry picked from commit 584c08e1fe)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:32:59 +01:00
Sebastiaan van Stijn 42811a7eb9
docs: add redirect for old reference URL
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit a4fb01f957)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:32:54 +01:00
Sebastiaan van Stijn be966aa194
docs: fix typo in deprecated.md
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 697c3a5b48)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:32:49 +01:00
Sebastiaan van Stijn b22fe0fb14
deprecate blkio-weight options with cgroups v1
These options were deprecated and removed in the Linux kernel v5.0 and up in;

- f382fb0bce
- fb5772cbfe
- 23aa16489c

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit fb2ea098a9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:32:44 +01:00
Harald Albers 4eb050071e
Update bash completion for fluentd --log-options
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit 5a252fb3ad)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:32:39 +01:00
Harald Albers 08c4fdfa7a
Add bash completion for `dockerd --ip6tables`
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit ba2fef9bcb)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:32:34 +01:00
Harald Albers 6aa1b37c8d
Add bash completion for `docker run|create --pull`
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit 8242fe1fcc)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:32:29 +01:00
rochfeu e82920d76d
Remove duplicate word in push.md
Signed-off-by: Roch Feuillade <roch.feuillade@pandobac.com>
(cherry picked from commit 69b5487e39)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:32:24 +01:00
Harald Albers 82123939f7
Add bash completion for jobs
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit a4e86b5433)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 14:32:17 +01:00
Tibor Vass 48d30b5b32 Use golang.org/x/sys/execabs
On Windows, the os/exec.{Command,CommandContext,LookPath} functions
resolve command names that have neither path separators nor file extension
(e.g., "git") by first looking in the current working directory before
looking in the PATH environment variable.
Go maintainers intended to match cmd.exe's historical behavior.

However, this is pretty much never the intended behavior and as an abundance of precaution
this patch prevents that when executing commands.
Example of commands that docker.exe may execute: `git`, `docker-buildx` (or other cli plugin), `docker-credential-wincred`, `docker`.

Note that this was prompted by the [Go 1.15.7 security fixes](https://blog.golang.org/path-security), but unlike in `go.exe`,
the windows path lookups in docker are not in a code path allowing remote code execution, thus there is no security impact on docker.

Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 8d199d5bba)
Signed-off-by: Tibor Vass <tibor@docker.com>
2021-01-28 22:27:59 +00:00
Tibor Vass 5941f4104a vendor docker, docker-credential-helpers and golang/sys for execabs package
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 7bef248765)
Signed-off-by: Tibor Vass <tibor@docker.com>
2021-01-28 22:27:59 +00:00
Chris Crone 18f33b337d context: Add tarball e2e tests
Signed-off-by: Chris Crone <christopher.crone@docker.com>
2021-01-28 22:27:59 +00:00
Chris Crone 9ecc69d17e context: Ensure context name is valid on import
Signed-off-by: Chris Crone <christopher.crone@docker.com>
2021-01-28 22:27:59 +00:00
Chris Crone 6f49197cab context: Ensure import paths are valid
Signed-off-by: Chris Crone <christopher.crone@docker.com>
2021-01-28 22:27:59 +00:00
Tibor Vass 2291f610ae
Merge pull request #2886 from thaJeztah/bump_buildkit
vendor: BuildKit v0.8.1, Engine v20.10.1
2020-12-22 09:32:20 -08:00
Sebastiaan van Stijn 6c97008f67
Merge pull request #2896 from ccouzens/patch-2
Fix link to docker build with squash experiment
2020-12-22 16:27:26 +01:00
Silvin Lubecki 1f0dff6752
Merge pull request #2883 from elboulangero/fix-container-creation-time-in-tests
Fix container creation time in test/builders
2020-12-22 14:18:49 +01:00
Chris Couzens 5e430753f2
Fix link to docker build with squash experiment
Signed-off-by: Chris Couzens <ccouzens@gmail.com>
2020-12-18 22:33:02 +00:00
Arnaud Rebillout 4d6bc775b3 Fix container creation time in test/builders
The created time of the containerd is initialized with nanoseconds,
it seems to be a mistake.

In other places of the code, this field is initialized with seconds:

    $ grep -rh 'time\.Now()\.Unix()' | grep Created
    Created: time.Now().Unix(),
    Created: time.Now().Unix(),
    return []image.HistoryResponseItem{{ID: img, Created: time.Now().Unix()}}, nil

We can also see the the formatter assumes it to be seconds:

    cli/command/formatter/container.go
    ----
    func (c *ContainerContext) CreatedAt() string {
        return time.Unix(c.c.Created, 0).String()
    }

Interestingly, initializing the field with nanoseconds seems to work,
except on mips architecture, where it causes some kind of overflow.

~~~~
=== Failed
=== FAIL: cli/command/container TestContainerListWithoutFormat (0.00s)
    list_test.go:183: assertion failed:
        --- expected
        +++ actual
        @@ -1,7 +1,7 @@
         CONTAINER ID   IMAGE            COMMAND   CREATED                  STATUS        PORTS                NAMES
        -container_id   busybox:latest   "top"     Less than a second ago   Up 1 second                        c1
        -container_id   busybox:latest   "top"     Less than a second ago   Up 1 second                        c2
        -container_id   busybox:latest   "top"     Less than a second ago   Up 1 second   80-82/tcp            c3
        -container_id   busybox:latest   "top"     Less than a second ago   Up 1 second   81/udp               c4
        -container_id   busybox:latest   "top"     Less than a second ago   Up 1 second   8.8.8.8:82->82/tcp   c5
        +container_id   busybox:latest   "top"     -153722867 minutes ago   Up 1 second                        c1
        +container_id   busybox:latest   "top"     -153722867 minutes ago   Up 1 second                        c2
        +container_id   busybox:latest   "top"     -153722867 minutes ago   Up 1 second   80-82/tcp            c3
        +container_id   busybox:latest   "top"     -153722867 minutes ago   Up 1 second   81/udp               c4
        +container_id   busybox:latest   "top"     -153722867 minutes ago   Up 1 second   8.8.8.8:82->82/tcp   c5

=== FAIL: cli/command/container TestContainerListNoTrunc (0.00s)
    list_test.go:198: assertion failed:
        --- expected
        +++ actual
        @@ -1,4 +1,4 @@
         CONTAINER ID   IMAGE            COMMAND   CREATED                  STATUS        PORTS     NAMES
        -container_id   busybox:latest   "top"     Less than a second ago   Up 1 second             c1
        -container_id   busybox:latest   "top"     Less than a second ago   Up 1 second             c2,foo/bar
        +container_id   busybox:latest   "top"     -153722867 minutes ago   Up 1 second             c1
        +container_id   busybox:latest   "top"     -153722867 minutes ago   Up 1 second             c2,foo/bar
~~~~

Logs above taken from:
https://buildd.debian.org/status/fetch.php?pkg=docker.io&arch=mipsel&ver=20.10.0%7Erc1%2Bdfsg3-1&stamp=1606895899

~~~~
=== RUN   TestChtimesLinux
    chtimes_linux_test.go:87: Expected: 2262-04-11 23:47:16 +0000 UTC, got: 1990-01-27 10:50:44 +0000 UTC
--- FAIL: TestChtimesLinux (0.00s)
=== RUN   TestChtimes
    chtimes_test.go:92: Expected: 2262-04-11 23:47:16 +0000 UTC, got: 1990-01-27 10:50:44 +0000 UTC
--- FAIL: TestChtimes (0.00s)
~~~~

Logs above taken from:
https://buildd.debian.org/status/fetch.php?pkg=docker.io&arch=mips64el&ver=20.10.0%7Erc1%2Bdfsg3-1&stamp=1606895622

Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>
2020-12-16 08:55:29 +07:00
Sebastiaan van Stijn 47ecb13fe4
vendor: github.com/docker/docker v20.10.1
full diff: cf31b9622a...v20.10.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-12-15 18:14:29 +01:00
Sebastiaan van Stijn a2b4d9c74f
vendor: github.com/moby/buildkit v0.8.1
full diff: https://github.com/moby/buildkit/compare/v0.8.0...v0.8.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-12-15 18:09:01 +01:00
Tibor Vass 831ebeae96
Merge pull request #2884 from thaJeztah/format_help_link
Help link: remove color, add "bold" style, and white-space
2020-12-14 18:27:14 -08:00
Sebastiaan van Stijn fa3e0bcdaf
Help link: remove color, add "bold" style, and white-space
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-12-14 14:28:29 +01:00
Silvin Lubecki 42d4489992
Merge pull request #2877 from Foxboron/morten/fix-man
generate-man.sh: Only build md2man if it's not installed
2020-12-10 09:41:38 +01:00