Commit Graph

7240 Commits

Author SHA1 Message Date
Sebastiaan van Stijn 83eda5313b
opts: simplify ValidateEnv to use os.LookupEnv
os.LookupEnv() was not available yet at the time this was
implemented, but now provides the functionality we need,
so replacing our custom handling.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-08-28 18:31:41 +02:00
Sebastiaan van Stijn c5bf79c37e
Merge pull request #2693 from thaJeztah/fix_dynbinary_in_devcontainer
Dockerfile: fix dynbinary inside dev container
2020-08-28 18:13:00 +02:00
Sebastiaan van Stijn 33510e0a68
vendor: bump github.com/fvbommel/sortorder v1.0.1
drops the dependency on github.com/xlab/handysort from go.mod

diff: https://github.com/fvbommel/sortorder/compare/v1.0.0...v1.0.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-08-28 18:10:11 +02:00
Sebastiaan van Stijn 0b8f46b061
Dockerfile: fix dynbinary inside dev container
Running `make dynbinary` inside the dev-container failed because
gcc was not installed. Adding the `build-base` metapackage, which
has gcc, make, g++ and other packages that are needed.

Before this change:

    $ make -f docker.Makefile shell
    $$ make dynbinary
    ./scripts/build/dynbinary
    Building dynamically linked build/docker-linux-amd64
    # github.com/docker/cli/cmd/docker
    /usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exec: "gcc": executable file not found in $PATH
    make: *** [Makefile:63: dynbinary] Error 2

With this patch applied

    $ make -f docker.Makefile shell
    $$ make dynbinary
    ./scripts/build/dynbinary
    Building dynamically linked build/docker-linux-amd64
    $$ echo $?
    0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-08-28 16:25:15 +02:00
Tibor Vass 8fc038afe7
Merge pull request #2694 from thaJeztah/fix_vbomml_util
Replace vbom.ml/util with fvbommel/sortorder
2020-08-28 16:00:24 +02:00
Sebastiaan van Stijn 6703919c71
Replace vbom.ml/util with fvbommel/sortorder
The vanity domain is down, and the project has moved
to a new location.

vendor check started failing because of this:

    Collecting initial packages
    Download dependencies
    unrecognized import path "vbom.ml/util" (https fetch: Get https://vbom.ml/util?go-get=1: dial tcp: lookup vbom.ml on 169.254.169.254:53: no such host)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-08-28 15:35:42 +02:00
Brian Goff 612567cb21
Merge pull request #2678 from thaJeztah/fix_rm_force_exit_status
Return zero exit-code when force-removing non-existing containers
2020-08-27 14:40:08 -07:00
Silvin Lubecki 697b25eb82
Merge pull request #2684 from thaJeztah/update_dockerignore
Update .dockerignore
2020-08-21 15:03:07 +02:00
Silvin Lubecki 8189013731
Merge pull request #2683 from thaJeztah/update_shellcheck
Dockerfiles: update shellcheck v0.7.1
2020-08-21 15:01:44 +02:00
Sebastiaan van Stijn 560ef73461
Update .dockerignore
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-08-20 15:46:46 +02:00
Sebastiaan van Stijn 43bc718895
Dockerfiles: update shellcheck v0.7.1
full diff: https://github.com/koalaman/shellcheck/compare/v0.7.0...v0.7.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-08-20 15:46:07 +02:00
Sebastiaan van Stijn ca35f2973a
Merge pull request #2646 from horpto/patch-1
Add shorthand for --tail option
2020-08-17 17:19:03 +02:00
Sebastiaan van Stijn f3c88f0eb0
Merge pull request #2672 from rchenzheng/ISSUE-2549/autocomplete-group
Issue 2549/autocomplete group and gpus support
2020-08-17 17:09:13 +02:00
Sebastiaan van Stijn 9a071a993a
Return zero exit-code when force-removing non-existing containers
When using `docker rm` / `docker container rm` with the `-f` / `--force` option, attempts to remove non-existing containers should print a warning, but should return a zero exit code ("successful").

Currently, a non-zero exit code is returned, marking the removal as "failed";

	$ docker rm -fv 798c9471b695
	Error: No such container: 798c9471b695
	$ echo $?
	1

The command should match the behavior of `rm` / `rm -f`, with the exception that
a warning is printed (instead of silently ignored):

Running `rm` with `-f` silences output and returns a zero exit code:

    touch some-file && rm -f no-such-file some-file; echo exit code: $?; ls -la
    # exit code: 0
    # total 0
    # drwxr-xr-x    2 sebastiaan  staff    64 Aug 14 12:17 .
    # drwxr-xr-x  199 sebastiaan  staff  6368 Aug 14 12:13 ..

    mkdir some-directory && rm -rf no-such-directory some-directory; echo exit code: $?; ls -la
    # exit code: 0
    # total 0
    # drwxr-xr-x    2 sebastiaan  staff    64 Aug 14 12:17 .
    # drwxr-xr-x  199 sebastiaan  staff  6368 Aug 14 12:13 ..

Note that other reasons for a delete to fail should still result in a non-zero
exit code, matching the behavior of `rm`. For instance, in the example below,
the `rm` failed because directories can only be removed if the `-r` option is used;

    touch some-file && mkdir some-directory && rm -f some-directory no-such-file some-file; echo exit code: $?; ls -la
    # rm: some-directory: is a directory
    # exit code: 1
    # total 0
    # drwxr-xr-x    3 sebastiaan  staff    96 Aug 14 14:15 .
    # drwxr-xr-x  199 sebastiaan  staff  6368 Aug 14 12:13 ..
    # drwxr-xr-x    2 sebastiaan  staff    64 Aug 14 14:15 some-directory

This patch updates the `docker rm` / `docker container rm` command to not produce
an error when attempting to remove a missing containers, and instead only print
the error, but return a zero (0) exit code.

With this patch applied:

    docker create --name mycontainer busybox \
    && docker rm nosuchcontainer mycontainer; \
    echo exit code: $?; \
    docker ps -a --filter name=mycontainer
    # df23cc8573f00e97d6e948b48d9ea7d75ce3b4faaab4fe1d3458d3bfa451f39d
    # mycontainer
    # Error: No such container: nosuchcontainer
    # exit code: 0
    # CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-08-14 16:17:40 +02:00
Richard Chen Zheng 288326da1c
Fix Auto complete options available:
- Add support for --gpus to run/create container in bash and zsh
  - Remove --group from run and update container as it's not a valid flag in zsh
  - Add --group-add --group-rm for create and update update service in bash

Signed-off-by: Richard Chen Zheng <58443436+rchenzheng@users.noreply.github.com>
2020-08-13 13:56:33 -04:00
Silvin Lubecki 95f57194eb
Merge pull request #2673 from thaJeztah/bump_golang_1.13.15
Bump Golang 1.13.15
2020-08-11 17:42:22 +02:00
Sebastiaan van Stijn 2315975272
Bump Golang 1.13.15
full diff: https://github.com/golang/go/compare/go1.13.14...go1.13.15

go1.13.15 (released 2020/08/06) includes security fixes to the encoding/binary
package. See the Go 1.13.15 milestone on the issue tracker for details.

https://github.com/golang/go/issues?q=milestone%3AGo1.13.15+label%3ACherryPickApproved

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-08-10 17:24:48 +02:00
horpto 0b7147a2a5 fix docs, completion and docker service
Signed-off-by: horpto <__Singleton__@hackerdom.ru>
2020-08-06 17:37:08 +03:00
Silvin Lubecki 51d96c7e08
Merge pull request #2668 from thaJeztah/fix_add_rm_handling_order
Fix order of processing of some xx-add/xx-rm service update flags
2020-08-06 15:26:30 +02:00
Silvin Lubecki 5209eb653c
Merge pull request #2671 from thaJeztah/update_authors
Update authors and mailmap
2020-08-06 08:19:34 +02:00
Sebastiaan van Stijn 9a41d99a81
Update authors and mailmap
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-08-06 01:58:32 +02:00
Sebastiaan van Stijn ac2ebacb9a
Merge pull request #2526 from thaJeztah/deprecate_old_config
document deprecation of legacy `~/.dockercfg` config-file
2020-08-05 09:40:45 +02:00
Sebastiaan van Stijn 97501d1be3
Merge pull request #2636 from eyherabh/patch-1
Replaces ADD with COPY in the COPY section
2020-08-05 09:22:51 +02:00
Sebastiaan van Stijn 2fc608cea6
Fix order of processing of some xx-add/xx-rm service update flags
Combining `-add` and `-rm` flags on `docker service update` should
be usable to explicitly replace existing options. The current order
of processing did not allow this, causing the `-rm` flag to remove
properties that were specified in `-add`. This behavior was inconsistent
with (for example) `--host-add` and `--host-rm`.

This patch updates the behavior to first remove properties, then
add new properties.

Note that there's still some improvements to make, to make the removal
more granulas (e.g. to make `--label-rm label=some-value` only remove
the label if value matches `some-value`); these changes are left for
a follow-up.

Before this change:
-----------------------------

Create a service with two env-vars

```bash
docker service create --env FOO=bar --env BAR=baz  --name=test nginx:alpine
docker service inspect --format '{{json .Spec.TaskTemplate.ContainerSpec.Env }}' test | jq .
[
  "FOO=bar",
  "BAR=baz"
]
```

Update the service, with the intent to replace the value of `FOO` for a new value

```bash
docker service update  --env-rm FOO --env-add FOO=updated-foo test
docker service inspect --format '{{json .Spec.TaskTemplate.ContainerSpec.Env }}' test | jq .
[
  "BAR=baz"
]
```

Create a service with two labels

```bash
docker service create --label FOO=bar --label BAR=baz  --name=test nginx:alpine
docker service inspect --format '{{json .Spec.Labels }}' test | jq .
{
  "BAR": "baz",
  "FOO": "bar"
}
```

Update the service, with the intent to replace the value of `FOO` for a new value

```bash
docker service update  --label-rm FOO --label-add FOO=updated-foo test
docker service inspect --format '{{json .Spec.Labels }}' test | jq .
{
  "BAR": "baz"
}
```

Create a service with two container labels

```bash
docker service create --container-label FOO=bar --container-label BAR=baz  --name=test nginx:alpine
docker service inspect --format '{{json .Spec.TaskTemplate.ContainerSpec.Labels }}' test | jq .
{
  "BAR": "baz",
  "FOO": "bar"
}
```

Update the service, with the intent to replace the value of `FOO` for a new value

```bash
docker service update  --container-label-rm FOO --container-label-add FOO=updated-foo test
docker service inspect --format '{{json .Spec.TaskTemplate.ContainerSpec.Labels }}' test | jq .
{
  "BAR": "baz",
}
```

With this patch applied:
--------------------------------

Create a service with two env-vars

```bash
docker service create --env FOO=bar --env BAR=baz  --name=test nginx:alpine
docker service inspect --format '{{json .Spec.TaskTemplate.ContainerSpec.Env }}' test | jq .
[
  "FOO=bar",
  "BAR=baz"
]
```

Update the service, and replace the value of `FOO` for a new value

```bash
docker service update  --env-rm FOO --env-add FOO=updated-foo test
docker service inspect --format '{{json .Spec.TaskTemplate.ContainerSpec.Env }}' test | jq .
[
  "BAR=baz",
  "FOO=updated-foo"
]
```

Create a service with two labels

```bash
docker service create --label FOO=bar --label BAR=baz  --name=test nginx:alpine
docker service inspect --format '{{json .Spec.Labels }}' test | jq .
{
  "BAR": "baz",
  "FOO": "bar"
}
```

Update the service, and replace the value of `FOO` for a new value

```bash
docker service update  --label-rm FOO --label-add FOO=updated-foo test
docker service inspect --format '{{json .Spec.Labels }}' test | jq .
{
  "BAR": "baz",
  "FOO": "updated-foo"
}
```

Create a service with two container labels

```bash
docker service create --container-label FOO=bar --container-label BAR=baz  --name=test nginx:alpine
docker service inspect --format '{{json .Spec.TaskTemplate.ContainerSpec.Labels }}' test | jq .
{
  "BAR": "baz",
  "FOO": "bar"
}
```

Update the service, and replace the value of `FOO` for a new value

```bash
docker service update  --container-label-rm FOO --container-label-add FOO=updated-foo test
docker service inspect --format '{{json .Spec.TaskTemplate.ContainerSpec.Labels }}' test | jq .
{
  "BAR": "baz",
  "FOO": "updated-foo"
}
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-08-04 19:09:59 +02:00
eyherabh 86cbe28510 Replaces ADD with COPY in the COPY section
Possibly a typo from reusing text from the ADD section.

Signed-off-by: Hugo Gabriel Eyherabide <hugogabriel.eyherabide@gmail.com>
2020-08-04 19:10:23 +03:00
Silvin Lubecki f4f962292d
Merge pull request #2655 from tonistiigi/remove-from-index
docs: remove docs for —-from=index
2020-08-03 12:11:20 +02:00
Sebastiaan van Stijn 3c0a167ed5
document deprecation of legacy `~/.dockercfg` config-file
The docker CLI up until v1.7.0 used the `~/.dockercfg` file to store credentials
after authenticating to a registry (`docker login`). Docker v1.7.0 replaced this
file with a new CLI configuration file, located in `~/.docker/config.json`. When
implementing the new configuration file, the old file (and file-format) was kept
as a fall-back, to assist existing users with migrating to the new file.

Given that the old file format encourages insecure storage of credentials
(credentials are stored unencrypted), and that no version of the CLI since
Docker v1.7.0 has created this file, the file is marked deprecated, and support
for this file will be removed in a future release.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-08-03 11:45:35 +02:00
Sebastiaan van Stijn 8a3788118a
Merge pull request #2657 from thaJeztah/bump_continuity
vendor: update containerd/continuity efbc4488d8fe1bdc16bde3b2d2990d9b3a899165
2020-07-30 21:40:25 +02:00
Sebastiaan van Stijn 1d9ee72178
Merge pull request #2654 from tonistiigi/rosetta
support emulated version detection
2020-07-30 21:40:01 +02:00
Sebastiaan van Stijn 5f979eeac2
Merge pull request #2661 from akerouanton/fix-service-formatter
Pretty service inspect fails when TaskTemplate.Resources is nil
2020-07-30 21:21:26 +02:00
Tonis Tiigi e531875ff0 support emulated version detection
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-30 11:38:29 -07:00
Sebastiaan van Stijn 5c9a8e9973
Merge pull request #2658 from thaJeztah/bump_fsutil
vendor: update tonistiigi/fsutil ae3a8d753069d0f76fbee396457e8b6cfd7cb8c3
2020-07-29 10:09:01 +02:00
Vincent Demeester 24ef01ce6e
Merge pull request #2659 from thaJeztah/bump_docker
vendor: update docker/docker 0f41a77c6993ade605a639fb25994cfe5e1b3fe8
2020-07-29 07:50:50 +00:00
Albin Kerouanton 21da11c5fd
docker service inspect fails when TaskTemplate.Resources is nil
When doing `docker service inspect --pretty` on services without
`TaskTemplate.Resources` or `TaskTemplate.Resources.Limits`, the command
fails. This is due to a missing check on ResourceLimitPids().

This bug has been introduced by 395a6d560d
and produces following error message:

```
Template parsing error: template: :139:10: executing "" at <.ResourceLimitPids>: error calling ResourceLimitPids: runtime error: invalid memory address or nil pointer dereference
```

Signed-off-by: Albin Kerouanton <albin@akerouanton.name>
2020-07-28 22:38:33 +02:00
Sebastiaan van Stijn 097d57314d
vendor: update docker/docker 0f41a77c6993ade605a639fb25994cfe5e1b3fe8
full diff: 78e6ffd279...0f41a77c69

Relevant changes:

- https://github.com/moby/moby/pull/41234 vendor: update buildkit to 4d1f260e8
- various updates to swagger files
- https://github.com/moby/moby/pull/41249 Replace swarm Capabilites API with cap add/drop API
    - updates swarmkit to 035d564a3686f5e348d861ec0c074ff26854c498
- https://github.com/moby/moby/pull/41254 Deprecate KernelMemory

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-07-28 17:16:03 +02:00
Sebastiaan van Stijn 293e239e18
vendor: update containerd/continuity efbc4488d8fe1bdc16bde3b2d2990d9b3a899165
full diff: 26c1120b8d...efbc4488d8

Relevant changes:

- sysx/xattr: fix and improve
    - fix getxattrAll: change initial buffer size to 128 to prevent unneeded
      iterations and change the logic to get the real size in case we get ERANGE
      rather than doubling the buffer)
    - improve listxattrAll; refactor for readability, prevent calling `listxattr()`
      twice. Handle condition when attributes size is changed in between the two
      calls to listxattr().
- Remove Windows' Readlink fork
    - Drops support for Go 1.12 and under
- Fix sameFile() to recognize empty files as the same
    - fixes "Empty files can diff as "modified" even when they're not"

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-07-28 17:12:12 +02:00
Sebastiaan van Stijn 79b4d93c1b
vendor: update tonistiigi/fsutil ae3a8d753069d0f76fbee396457e8b6cfd7cb8c3
full diff: c2c7d7b0e1...ae3a8d7530

Relevant changes

- Update dependencies
    - update docker/docker to current master
    - update opencontainers/runc to v1.0.0-rc10
    - update pkg/errors to v0.9.1 to support Go 1.13 errors
    - update stretchr/testify to the latest version
- Drop support for go1.12, and use errors.Is() for error-detection

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-07-28 16:19:54 +02:00
Tonis Tiigi 5dd9bd4c2c docs: remove docs for —-from=index
Naming stages is the preferred method for using
multi-stage builds.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-27 15:56:23 -07:00
Brian Goff 415fe22dbe
Merge pull request #2652 from AkihiroSuda/deprecate-kernel-memory
deprecate `docker run --kernel-memory`
2020-07-27 10:35:10 -07:00
Akihiro Suda 074a8dcff6
deprecate `docker run --kernel-memory`
`docker run --kernel-memory` is being deprecated in https://github.com/moby/moby/pull/41254

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-07-24 20:56:15 +09:00
Brian Goff 12b74cb5a0
Merge pull request #2395 from wangyumu/add-default-address-pools-to-docker-info 2020-07-23 13:44:37 -07:00
horpto 04ab71457a Add shorthand for --tail option
I chose -n shorthand as it's similar with linux `tail` command.

Signed-off-by: Александр Менщиков <__Singleton__@hackerdom.ru>
2020-07-23 15:25:12 +03:00
Wang Yumu 1f907fb7ba Add DefaultAddressPools to docker info output #40388
Signed-off-by: Wang Yumu <37442693@qq.com>
2020-07-22 01:45:30 +08:00
Sebastiaan van Stijn 280e7230d5
Merge pull request #2641 from thaJeztah/bump_docker
vendor: update docker and buildkit
2020-07-21 16:49:04 +02:00
Silvin Lubecki bc2c8d9830
Merge pull request #2639 from thaJeztah/remove_shellwords
Replace mattn/go-shellwords with google/shlex
2020-07-21 15:06:47 +02:00
Silvin Lubecki ede188c951
Merge pull request #2634 from thaJeztah/bump_golang_1.13.14
Bump Golang 1.13.14
2020-07-21 15:05:14 +02:00
Tibor Vass aca38b347b
Merge pull request #2638 from mirogula/feature/add-build-target-zsh-completion
added 'docker build --target' to zsh completion
2020-07-21 13:26:36 +02:00
Tibor Vass b3a8358787
Merge pull request #2624 from justinkb/csfix
scripts/make.ps1: actually define the CommitSuffix parameter
2020-07-21 13:24:11 +02:00
Sebastiaan van Stijn 52ec986b5a
vendor: docker/docker 78e6ffd279b627ebba046b9675ff4849091d9cc3
full diff: aaf470eca7...78e6ffd279

- Add DefaultAddressPools to Info
- Configure shims from runtime config
- pkg/archive: use containerd/sys to detect UserNamespaces
    - removes github.com/opencontainers/runc/libcontainer/system dependency
- pkg/archive: Don't use init() to set unpigz path

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-07-20 20:01:27 +02:00
Sebastiaan van Stijn c496fefe4d
vendor: buildkit df35e9818d1f9066e616e03f4b8d727c97562e5b
full diff: ae7ff7174f...df35e9818d

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-07-20 15:50:51 +02:00