Commit Graph

533 Commits

Author SHA1 Message Date
Tibor Vass 5314a8fc06 build: Add support for using dockerfile from stdin with buildkit
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-09 20:51:34 +00:00
Tibor Vass e0b3921a03 build: Add support for using context from stdin with buildkit
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-09 20:51:34 +00:00
Tonis Tiigi 8cf213bd0c build: use a separate upload request for early progress
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-09 20:51:34 +00:00
Tonis Tiigi b19294ee42 system: add buildcache formatting
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-09 20:51:34 +00:00
Tonis Tiigi 0f97642915 build: basic buildkit progress support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-09 20:51:34 +00:00
Tonis Tiigi 656fe85c74 build: add experimental buildkit base
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-09 20:51:30 +00:00
Vincent Demeester b1065767cd
Bump moby version (and its dependencies)
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-08 11:26:10 +02:00
Vincent Demeester eaa9149e29
Merge pull request #948 from simonferquel/k8s-watch-stack-status
K8s: more robust stack error detection on deploy
2018-06-04 10:42:42 +02:00
Vincent Demeester d1cc8c731e
Merge pull request #1105 from vdemeester/1044-compress-stream-friend
Fix panics when --compress and --stream are used together
2018-06-01 23:00:01 +02:00
Vincent Demeester 8b3dc39fce
Fix panics when --compress and --stream are used together
Warns that `-compress` has no effect when used together with the
expremintal `--stream` flag.

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

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

Before:

    docker

    Usage:	docker COMMAND

    A self-sufficient runtime for containers

    ...

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

After:

    docker

    Usage:	docker COMMAND

    A self-sufficient runtime for containers

    ...

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

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

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

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

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

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

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

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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-05-31 22:25:06 +02:00
Sebastiaan van Stijn bb71808605
Add test for version output aligning
Includes some refactoring to allow testing the output
in isolation.

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

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

Before this change;

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

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

After this change:

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

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

Other stack commands were updated as well:

Before this change;

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

    docker stack ps ''
    nothing found in stack:

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

After this change:

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

    docker stack ps ''
    invalid stack name: ""

    docker stack rm ''
    invalid stack name: ""

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-05-28 17:03:26 +02:00
Silvin Lubecki f2b75a879a Remove experimentalCli annotation from all kubernetes flags and commands
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2018-05-28 15:06:31 +02:00
Vincent Demeester 537e67d462
Merge pull request #1084 from thaJeztah/minor-code-refactor
Minor refactor in stack helper functions
2018-05-28 12:39:15 +02:00
Sebastiaan van Stijn 0c175fc21a
Minor refactor in stack helper functions
- Don't wrap the code to be slightly more readable
- Rename `getServiceFilter()` to `getStackServiceFilter()` to be
  consistent with other helper functions.

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

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

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

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

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

Verify the configuration

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

Update just CPU limit and reservation:

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

Notice that the memory limit and reservation is not preserved:

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

Update just Memory limit and reservation:

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

Notice that the CPU limit and reservation is not preserved:

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

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

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

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

Verify the configuration

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

Update just CPU limit and reservation:

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

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

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

Update just Memory limit and reservation:

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

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

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

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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-05-24 01:30:00 +02:00
Simon Ferquel 1f7aa1c036 Add filter support for stack ps and services with Kubernetes
Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2018-05-23 18:27:27 +02:00
Vincent Demeester cc6ff56fd5
Merge pull request #1035 from mat007/kubernetes-check-hosts-match
For docker stack ls make an error if Swarm and Kubernetes hosts do not match
2018-05-22 14:50:09 +02:00
Mathieu Champlon bfe9aed63a For docker stack ls make an error if Swarm and Kubernetes hosts do no match
Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2018-05-22 14:39:48 +02:00
Sebastiaan van Stijn 680c5790d5
Merge pull request #1043 from justyntemme/patch-2
Fix issue #850, Warn user of filter when pruning
2018-05-22 00:26:26 +02:00
Victor Vieux 7bdd820f28
Merge pull request #1054 from thaJeztah/fix-host-rm-being-too-greedy
Fix service update --host-rm not being granular enough
2018-05-21 15:21:06 -07:00
Sebastiaan van Stijn 9a89c32e9a
Merge pull request #1053 from justyntemme/patch-3
Change error message for unreadable files
2018-05-22 00:12:46 +02:00
Anda Xu d2090430a6 fix error message from docker inspect
Signed-off-by: Anda Xu <anda.xu@docker.com>
2018-05-21 11:32:16 -07:00
Vincent Demeester b15c3cfec9
Merge pull request #1065 from thaJeztah/fix-kube-alignment
Fix component information alignment
2018-05-18 14:54:42 +02:00
Sebastiaan van Stijn 26d8122594
Fix component information alignment
The `docker version` output now uses a tabwriter, so use single
tabs to print the output.

Before this change:

    Server:
     Engine:
      Version:      18.05.0-ce
      API version:  1.37 (minimum version 1.12)
      Go version:   go1.10.1
      Git commit:   f150324
      Built:        Wed May  9 22:20:16 2018
      OS/Arch:      linux/amd64
      Experimental: true
     Kubernetes:
      Version:     v1.9.6
      StackAPI:                   v1beta2

After this change:

    Server:
     Engine:
      Version:      18.05.0-ce
      API version:  1.37 (minimum version 1.12)
      Go version:   go1.10.1
      Git commit:   f150324
      Built:        Wed May  9 22:20:16 2018
      OS/Arch:      linux/amd64
      Experimental: true
     Kubernetes:
      Version:     v1.9.6
      StackAPI:    v1beta2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-05-18 14:46:23 +02:00
Mathieu Champlon bd20885ac8 Query UCP Kubernetes user namespaces endpoint
Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2018-05-18 11:44:15 +02:00
Mathieu Champlon 5d54584f03 Bump moby to d37f5c6bdf788a6cb82c07fb707e31a240eff5f9
Also bringing:
. golang.org/x/net 5561cd9b4330353950f399814f427425c0a26fd2
. github.com/docker/distribution 83389a148052d74ac602f5f1d62f86ff2f3c4aa5
. github.com/docker/swarmkit bd69f6e8e301645afd344913fa1ede53a0a111fb
. github.com/docker/go-metrics d466d4f6fd960e01820085bd7e1a24426ee7ef18
. github.com/prometheus/client_golang 52437c81da6b127a9925d17eb3a382a2e5fd395e
. github.com/beorn7/perks 4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9
. github.com/prometheus/client_model fa8ad6fec33561be4280a8f0514318c79d7f6cb6
. github.com/prometheus/common ebdfc6da46522d58825777cf1f90490a5b1ef1d8
. github.com/prometheus/procfs abf152e5f3e97f2fafac028d2cc06c1feb87ffa5
. github.com/matttproud/golang_protobuf_extensions v1.0.0

Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2018-05-18 11:44:14 +02:00
Sebastiaan van Stijn bac0d8f353
Merge pull request #974 from simonferquel/compose-kube-env-expansion
[K8s] Do env-variable expansion on the uninterpreted Config files
2018-05-16 20:18:41 +02:00
Mathieu Champlon 84241cc393 Support multiple namespaces for docker stack ls
Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2018-05-15 16:52:21 +02:00
Mathieu Champlon 4d947de292 Support 'all' in orchestrator flag for docker stack ls
All other docker stack commands report an error when passed this value.

Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2018-05-15 15:38:41 +02:00
Vincent Demeester 161bc1ed3c
Merge pull request #1055 from mat007/fix-invalid-orchestrator-silently-ignored
Make an error for an invalid orchestrator
2018-05-14 15:34:01 +02:00
Vincent Demeester 74d86d4b2e
Merge pull request #1052 from thaJeztah/fix-rollback-config
Fix service rollback options being cross-wired
2018-05-14 11:01:56 +02:00
Vincent Demeester d4ffd9bc71
Merge pull request #1037 from essamhassan/1036_fix_mounts_typo_in_srv_inspect_pretty
use : instead of = in mounts service pretty inspect
2018-05-14 10:55:41 +02:00
Brian Goff fd060d2f33
Merge pull request #1038 from kolyshkin/context
Switch from x/net/context to context
2018-05-11 22:13:52 -04:00
Kir Kolyshkin 395957155f cli/command/container: don't leak context
Switch from x/net/context to context made "go vet" see the previously
unseen errors:

> cli/command/container/start.go:57::error: the cancelFun function is
> not used on all paths (possible context leak) (vet)
> cli/command/container/start.go:63::error: this return statement may be
> reached without using the cancelFun var defined on line 57 (vet)

> cli/command/container/run.go:159::error: the cancelFun function is not
> used on all paths (possible context leak) (vet)
> cli/command/container/run.go:164::error: this return statement may be
> reached without using the cancelFun var defined on line 159 (vet)

Do call the cancel function.

Note we might end up calling it twice which is fine as long as I can see
from the Go 1.10 source code.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-05-11 16:50:04 -07:00
Kir Kolyshkin 6f8070deb2 Switch from x/net/context to context
Since go 1.7, "context" is a standard package. Since go 1.9,
x/net/context merely provides some types aliased to those in
the standard context package.

The changes were performed by the following script:

for f in $(git ls-files \*.go | grep -v ^vendor/); do
	sed -i 's|golang.org/x/net/context|context|' $f
	goimports -w $f
	for i in 1 2; do
		awk '/^$/ {e=1; next;}
			/\t"context"$/ {e=0;}
			{if (e) {print ""; e=0}; print;}' < $f > $f.new && \
				mv $f.new $f
		goimports -w $f
	done
done

[v2: do awk/goimports fixup twice]
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-05-11 16:49:43 -07:00
Essam A. Hassan 7285241681 use : instead of = in mounts service pretty inspect
Signed-off-by: Essam A. Hassan <es.hassan187@gmail.com>
2018-05-12 00:02:18 +02:00