Commit Graph

1350 Commits

Author SHA1 Message Date
71cfdc53d3 Remove unused windows resourcefiles.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 329f4e29c5
Component: cli
2017-05-15 22:50:33 -04:00
d7802c7d2b Add windows resources to binary.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 8a6ad48d2b
Component: cli
2017-05-15 18:03:03 -04:00
54778e28e7 Merge pull request #78 from dnephin/fix-cross-build
Fix cross compile build
Upstream-commit: a2225276af
Component: cli
2017-05-15 12:31:34 -07:00
15f41f0cf9 Merge pull request #82 from vdemeester/opts-from-docker
Import `opts` package from moby/moby
Upstream-commit: 36e557f1a3
Component: cli
2017-05-15 11:38:59 -07:00
a6473845ef Update the README
Remove referenced to developing on the host, we shouldn't support it.

Move script/validate to scripts/validate to be consistent.
Set the default target to be binary instead of clean.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 60b2dd3e23
Component: cli
2017-05-15 14:07:30 -04:00
ca78770821 Add VERSION file
This file is used for auto-assigning milestones
to PR's by Poule, but may be usefule in general

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 35c6e555e0
Component: cli
2017-05-15 19:20:12 +02:00
242da31a23 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>
Upstream-commit: d7f6563efc
Component: cli
2017-05-15 14:45:19 +02:00
fd70e3c064 Update CLI docs and add opts/config.go
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 560dc7660f
Component: cli
2017-05-15 11:57:21 +02:00
9d6529ee2a support custom paths for secrets
This adds support to specify custom container paths for secrets.

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
Upstream-commit: 08097edc78
Component: cli
2017-05-15 11:57:21 +02:00
5307ef4aee Remove pkg/testutil/assert in favor of testify
I noticed that we're using a homegrown package for assertions. The
functions are extremely similar to testify, but with enough slight
differences to be confusing (for example, Equal takes its arguments in a
different order). We already vendor testify, and it's used in a few
places by tests.

I also found some problems with pkg/testutil/assert. For example, the
NotNil function seems to be broken. It checks the argument against
"nil", which only works for an interface. If you pass in a nil map or
slice, the equality check will fail.

In the interest of avoiding NIH, I'm proposing replacing
pkg/testutil/assert with testify. The test code looks almost the same,
but we avoid the confusion of having two similar but slightly different
assertion packages, and having to maintain our own package instead of
using a commonly-used one.

In the process, I found a few places where the tests should halt if an
assertion fails, so I've made those cases (that I noticed) use "require"
instead of "assert", and I've vendored the "require" package from
testify alongside the already-present "assert" package.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: eb366ae039
Component: cli
2017-05-15 11:57:21 +02:00
bb56c4e17a Make the CLI show defaults from the swarmkit defaults package
If no fields related to an update config or restart policy are
specified, these structs should not be created as part of the service,
to avoid hardcoding the current defaults.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: d160d98970
Component: cli
2017-05-15 11:57:21 +02:00
acf27ff01d api: Remove SecretRequestOption type
This type is only used by CLI code. It duplicates SecretReference in the
types/swarm package. Change the CLI code to use that type instead.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 4cde08da8e
Component: cli
2017-05-15 11:57:21 +02:00
36751c1dc3 Use opts.MemBytes for flags.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 2a4ce79981
Component: cli
2017-05-15 11:57:21 +02:00
95324d952c Add expanded mount syntax to Compose schema and types.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 5a39df474b
Component: cli
2017-05-15 11:57:21 +02:00
e6a6e884b0 Add 'consistent', 'cached', and 'delegated' mode flags
This adds 'consistency' mode flags to the mount command line argument.
Initially, the valid 'consistency' flags are 'consistent', 'cached',
'delegated', and 'default'.

Signed-off-by: David Sheets <dsheets@docker.com>
Signed-off-by: Jeremy Yallop <yallop@docker.com>
Upstream-commit: ce42bb22a3
Component: cli
2017-05-15 11:57:21 +02:00
3fa476a5ea Make sure we validate simple syntax on service commands
We ignored errors for simple syntax in `PortOpt` (missed that in the
previous migration of this code). This make sure we don't ignore
`nat.Parse` errors.

Test has been migrate too (errors are not exactly the same as before
though -_-)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 7fa9161585
Component: cli
2017-05-15 11:57:21 +02:00
b28053256b Update opts.MemBytes to disable default, and move docker run/create/build to use opts.MemBytes
This fix made several updates:
1. Update opts.MemBytes so that default value will not show up.
   The reason is that in case a default value is decided by daemon,
   instead of client, we actually want to not show default value.
2. Move `docker run/create/build` to use opts.MemBytes for `--shm-size`
   This is to bring consistency between daemon and docker run
3. docs updates.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 629abab4c0
Component: cli
2017-05-15 11:57:21 +02:00
5375c51c00 Add daemon option --default-shm-size
This fix fixes issue raised in 29492 where it was not
possible to specify a default `--default-shm-size` in daemon
configuration for each `docker run``.

The flag `--default-shm-size` which is reloadable, has been
added to the daemon configuation.
Related docs has been updated.

This fix fixes 29492.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 5a9a1569b9
Component: cli
2017-05-15 11:57:21 +02:00
ff407739d9 Add "src" alias for --secret
This patch adds a "src" alias for `--secret`
to be consistent with `--mount`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: e7020eefd0
Component: cli
2017-05-15 11:57:21 +02:00
96bfe1f1e2 Add error checking for hostPort range
This fix catches the case where there is a single container port
and a dynamic host port and will fail out gracefully
Example docker-compose.yml snippet:
    port:
        ports:
            - "8091-8093:8091"
            - "80:8080"

Signed-off-by: Tony Abboud <tdabboud@hotmail.com>
Upstream-commit: 438279688c
Component: cli
2017-05-15 11:57:21 +02:00
209e223594 Trim quotes from TLS flags.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 52e9a69df9
Component: cli
2017-05-15 11:57:21 +02:00
41104f7868 Add quoted string flag Value.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 8eeed60a68
Component: cli
2017-05-15 11:57:21 +02:00
0d62ef5bf9 Improve usage output for docker run
Commit a77f2450c70312f8c26877a18bfe2baa44d4abb9 switched `docker run`
to use the `pflags` package. Due to this change, the usage output for
the `--blkio-weight-device` and `--device-*` flags changed and now
showed `weighted-device`, and `throttled-device` as value type. As a
result, the output of `docker run --help` became a lot wider.

This patch changes the output to show `list` instead, which is
consistent with other options that allow to be set multiple times.

Output before this change;

    Usage:	docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

    Run a command in a new container

    Options:
          --blkio-weight uint16                   Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)
          --blkio-weight-device weighted-device   Block IO weight (relative device weight) (default [])
          --device list                           Add a host device to the container (default [])
          --device-read-bps throttled-device      Limit read rate (bytes per second) from a device (default [])
          --device-read-iops throttled-device     Limit read rate (IO per second) from a device (default [])
          --device-write-bps throttled-device     Limit write rate (bytes per second) to a device (default [])
          --device-write-iops throttled-device    Limit write rate (IO per second) to a device (default [])
      -w, --workdir string                        Working directory inside the container

Output after this change;

    Usage:	docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

    Run a command in a new container

    Options:
          --blkio-weight uint16         Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)
          --blkio-weight-device list    Block IO weight (relative device weight) (default [])
          --device list                 Add a host device to the container (default [])
          --device-read-bps list        Limit read rate (bytes per second) from a device (default [])
          --device-read-iops list       Limit read rate (IO per second) from a device (default [])
          --device-write-bps list       Limit write rate (bytes per second) to a device (default [])
          --device-write-iops list      Limit write rate (IO per second) to a device (default [])
      -w, --workdir string              Working directory inside the container

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: ab92626619
Component: cli
2017-05-15 11:57:20 +02:00
aa327d9859 Update docker daemon to dockerd
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
Upstream-commit: ad345939d1
Component: cli
2017-05-15 11:57:20 +02:00
849a1bf0da Clean some stuff from runconfig that are cli only…
… or could be in `opts` package. Having `runconfig/opts` and `opts`
doesn't really make sense and make it difficult to know where to put
some code.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 8b725e10e7
Component: cli
2017-05-15 11:57:20 +02:00
39709b6c3f Change tls to TLS
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
Upstream-commit: a58827b0c2
Component: cli
2017-05-15 11:57:20 +02:00
45ff71115e Make --publish-rm precedes --publish-add, so that add wins
`--publish-add 8081:81 --publish-add 8082:82 --publish-rm 80
--publish-rm 81/tcp --publish-rm 82/tcp` would thus result in 81 and
82 to be published.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 16bbd3441a
Component: cli
2017-05-15 11:57:20 +02:00
2099b04c54 Remove --port and update --publish for services to support syntaxes
Add support for simple and complex syntax to `--publish` through the
use of `PortOpt`.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 016a56b064
Component: cli
2017-05-15 11:57:20 +02:00
287100bb17 Return error for incorrect argument of service update --publish-rm <TargetPort>
Currently `--publish-rm` only accepts `<TargetPort>` or `<TargetPort>[/Protocol]`
though there are some confusions.

Since `--publish-add` accepts `<PublishedPort>:<TargetPort>[/Protocol]`, some user
may provide `--publish-rm 80:80`. However, there is no error checking so the incorrect
provided argument is ignored silently.

This fix adds the check to make sure `--publish-rm` only accepts `<TargetPort>[/Protocol]`
and returns error if the format is invalid.

The `--publish-rm` itself may needs to be revisited to have a better UI/UX experience,
see discussions on:
https://github.com/docker/swarmkit/issues/1396
https://github.com/docker/docker/issues/25200#issuecomment-236213242
https://github.com/docker/docker/issues/25338#issuecomment-240787002

This fix is short term measure so that end users are not misled by the silently ignored error
of `--publish-rm`.

This fix is related to (but is not a complete fix):
https://github.com/docker/swarmkit/issues/1396

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 1b400f6284
Component: cli
2017-05-15 11:57:20 +02:00
a3052deb52 fix a few golint errors
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Upstream-commit: 4d5944cd51
Component: cli
2017-05-15 11:57:20 +02:00
8543a49ef3 fix t.Errorf to t.Error in serveral _test.go
Signed-off-by: wefine <wang.xiaoren@zte.com.cn>
Upstream-commit: 9806df060b
Component: cli
2017-05-15 11:57:20 +02:00
283b152e13 Add support for host port PublishMode in services
Add api/cli support for adding host port PublishMode in services.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
Upstream-commit: 7426b9d61b
Component: cli
2017-05-15 11:57:20 +02:00
7f7816f275 Add swarmkit fields to stack service.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 18ad4598a8
Component: cli
2017-05-15 11:57:20 +02:00
4f8d2f0ec7 SecretRequestOptions -> SecretRequestOption
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
Upstream-commit: 9d3c317c95
Component: cli
2017-05-15 11:57:20 +02:00
17050a7d9e secrets: support simple syntax --secret foo
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
Upstream-commit: 7180c8afed
Component: cli
2017-05-15 11:57:19 +02:00
8e84f86f88 move secretopt to opts pkg
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
Upstream-commit: 20525b5695
Component: cli
2017-05-15 11:57:19 +02:00
25d6f1620e Remove -ptr from the help output of service create
This fix is based on the comment:
https://github.com/docker/docker/pull/28147#discussion_r86996347

Previously the output string of the `DurationOpt` is `duration-ptr`
and `Uint64Opt` is `uint64-ptr`. While it is clear to developers,
for a normal user `-ptr` might not be very informative.

On the other hand, the default value of `DurationOpt` and `Uint64Opt`
has already been quite informative: `none`. That means if no flag
provided, the value will be treated as none.
(like a ptr with nil as the default)

For that reason this fix removes the `-ptr`.

Also, the output in the docs of `service create` has been quite
out-of-sync with the true output. So this fix updates the docs
to have the most up-to-date help output of `service create --help`.

This fix is related to #28147.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 583dd83727
Component: cli
2017-05-15 11:57:19 +02:00
1a65247350 opts/mount: add tmpfs-specific options
added following options:

 * tmpfs-size
 * tmpfs-mode

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Upstream-commit: 547dc2052c
Component: cli
2017-05-15 11:57:19 +02:00
bca6247652 Add --cpus flag to control cpu resources
This fix tries to address the proposal raised in 27921 and add
`--cpus` flag for `docker run/create`.

Basically, `--cpus` will allow user to specify a number (possibly partial)
about how many CPUs the container will use. For example, on a 2-CPU system
`--cpus 1.5` means the container will take 75% (1.5/2) of the CPU share.

This fix adds a `NanoCPUs` field to `HostConfig` since swarmkit alreay
have a concept of NanoCPUs for tasks. The `--cpus` flag will translate
the number into reused `NanoCPUs` to be consistent.

This fix adds integration tests to cover the changes.

Related docs (`docker run` and Remote APIs) have been updated.

This fix fixes 27921.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 17e9503bbb
Component: cli
2017-05-15 11:57:19 +02:00
fc08f2c126 cli: add --mount to docker run
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Upstream-commit: 3375ba2acd
Component: cli
2017-05-15 11:57:19 +02:00
f8263c2df8 Add engine-api types to docker
This moves the types for the `engine-api` repo to the existing types
package.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 11d7f42b49
Component: cli
2017-05-15 11:57:19 +02:00
c2d278ab8c correct some nits in comment and test files
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 6083de8891
Component: cli
2017-05-15 11:57:19 +02:00
d94e1f7806 Convert dockerd to use cobra and pflag
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: ac76967dba
Component: cli
2017-05-15 11:57:19 +02:00
68e6f77ee4 Fix opts tests after default port fix
The code for default port was already there but
it didn’t work because split function errored out
before. This should be the desired behavior that
matches daemon listen address with swarm listen
address.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 63d756f347
Component: cli
2017-05-15 11:57:19 +02:00
3e6d08e7ea Unify swarm init and update options
Add api side validation and defaults for init and
join requests.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 881833232e
Component: cli
2017-05-15 11:57:19 +02:00
8c71d519a4 Add Swarm management backend
As described in our ROADMAP.md, introduce new Swarm management API
endpoints relying on swarmkit to deploy services. It currently vendors
docker/engine-api changes.

This PR is fully backward compatible (joining a Swarm is an optional
feature of the Engine, and existing commands are not impacted).

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Victor Vieux <vieux@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
Signed-off-by: Madhu Venugopal <madhu@docker.com>
Upstream-commit: 4f87181ba9
Component: cli
2017-05-15 11:57:19 +02:00
a3e334ca24 fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 662b3de10a
Component: cli
2017-05-15 11:57:18 +02:00
a81f1c609e Update usage and help to (almost) match the existing docker behaviour
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 17b3d05419
Component: cli
2017-05-15 11:57:18 +02:00
b3d34e0946 Migrate volume commands to cobra.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: b9fe270259
Component: cli
2017-05-15 11:57:18 +02:00
f488d74f98 Add support for setting sysctls
This patch will allow users to specify namespace specific "kernel parameters"
for running inside of a container.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
Upstream-commit: 1419abf7b2
Component: cli
2017-05-15 11:57:18 +02:00