Commit Graph

181 Commits

Author SHA1 Message Date
Daniel Nephin 3724fb7f37 Add gosimple lint
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
Vincent Demeester 4ffefe4a1f Merge pull request #115 from jsoref/spelling
Spelling
2017-06-14 09:58:55 +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
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
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 0893ab8560 moving opts to cli repo
Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2017-05-17 21:08:58 -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
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 560dc7660f Update CLI docs and add opts/config.go
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-05-15 11:57:21 +02:00
Evan Hazlett 08097edc78 support custom paths for secrets
This adds support to specify custom container paths for secrets.

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-05-15 11:57:21 +02:00
Aaron Lehmann eb366ae039 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>
2017-05-15 11:57:21 +02:00
Aaron Lehmann d160d98970 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>
2017-05-15 11:57:21 +02:00
Aaron Lehmann 4cde08da8e 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>
2017-05-15 11:57:21 +02:00
Daniel Nephin 2a4ce79981 Use opts.MemBytes for flags.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-15 11:57:21 +02:00
Daniel Nephin 5a39df474b Add expanded mount syntax to Compose schema and types.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-15 11:57:21 +02:00
David Sheets ce42bb22a3 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>
2017-05-15 11:57:21 +02:00
Vincent Demeester 7fa9161585 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>
2017-05-15 11:57:21 +02:00
Yong Tang 629abab4c0 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>
2017-05-15 11:57:21 +02:00
Yong Tang 5a9a1569b9 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>
2017-05-15 11:57:21 +02:00
Sebastiaan van Stijn e7020eefd0 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>
2017-05-15 11:57:21 +02:00
Tony Abboud 438279688c 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>
2017-05-15 11:57:21 +02:00
Daniel Nephin 52e9a69df9 Trim quotes from TLS flags.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-15 11:57:21 +02:00
Daniel Nephin 8eeed60a68 Add quoted string flag Value.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-15 11:57:21 +02:00
Sebastiaan van Stijn ab92626619 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>
2017-05-15 11:57:20 +02:00
yuexiao-wang ad345939d1 Update docker daemon to dockerd
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2017-05-15 11:57:20 +02:00
Vincent Demeester 8b725e10e7 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>
2017-05-15 11:57:20 +02:00
yuexiao-wang a58827b0c2 Change tls to TLS
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2017-05-15 11:57:20 +02:00
Vincent Demeester 16bbd3441a 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>
2017-05-15 11:57:20 +02:00
Vincent Demeester 016a56b064 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>
2017-05-15 11:57:20 +02:00
Yong Tang 1b400f6284 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>
2017-05-15 11:57:20 +02:00
Victor Vieux 4d5944cd51 fix a few golint errors
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-05-15 11:57:20 +02:00
wefine 9806df060b fix t.Errorf to t.Error in serveral _test.go
Signed-off-by: wefine <wang.xiaoren@zte.com.cn>
2017-05-15 11:57:20 +02:00
Jana Radhakrishnan 7426b9d61b 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>
2017-05-15 11:57:20 +02:00
Daniel Nephin 18ad4598a8 Add swarmkit fields to stack service.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-15 11:57:20 +02:00
Evan Hazlett 9d3c317c95 SecretRequestOptions -> SecretRequestOption
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-05-15 11:57:20 +02:00
Evan Hazlett 7180c8afed secrets: support simple syntax --secret foo
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-05-15 11:57:19 +02:00
Evan Hazlett 20525b5695 move secretopt to opts pkg
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-05-15 11:57:19 +02:00
Yong Tang 583dd83727 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>
2017-05-15 11:57:19 +02:00
Akihiro Suda 547dc2052c opts/mount: add tmpfs-specific options
added following options:

 * tmpfs-size
 * tmpfs-mode

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-05-15 11:57:19 +02:00
Yong Tang 17e9503bbb 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>
2017-05-15 11:57:19 +02:00
Akihiro Suda 3375ba2acd cli: add `--mount` to `docker run`
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-05-15 11:57:19 +02:00
Michael Crosby 11d7f42b49 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>
2017-05-15 11:57:19 +02:00
allencloud 6083de8891 correct some nits in comment and test files
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-05-15 11:57:19 +02:00
Daniel Nephin ac76967dba Convert dockerd to use cobra and pflag
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-15 11:57:19 +02:00
Tonis Tiigi 63d756f347 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>
2017-05-15 11:57:19 +02:00
Tonis Tiigi 881833232e 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>
2017-05-15 11:57:19 +02:00
Tonis Tiigi 4f87181ba9 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>
2017-05-15 11:57:19 +02:00
allencloud 662b3de10a fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-05-15 11:57:18 +02:00
Daniel Nephin 17b3d05419 Update usage and help to (almost) match the existing docker behaviour
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-15 11:57:18 +02:00
Daniel Nephin b9fe270259 Migrate volume commands to cobra.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-15 11:57:18 +02:00
Dan Walsh 1419abf7b2 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>
2017-05-15 11:57:18 +02:00
John Howard 1688110fd6 Windows: Remove TP4 support from main code
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-05-15 11:57:18 +02:00
allencloud a5f0686bf0 fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-05-15 11:57:18 +02:00
John Starks 6ad28f55d5 Windows: Default to npipe transport
This changes the default transport for Windows from unencrypted TCP to
npipe. This is similar to how Linux runs with the unix socket transport by
default.

Signed-off-by: John Starks <jostarks@microsoft.com>
2017-05-15 11:57:18 +02:00
David Calavera 2b140819b3 Upgrade Go to 1.6.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2017-05-15 11:57:18 +02:00
John Starks 5d648746e8 Windows: Add support for named pipe protocol
This adds an npipe protocol option for Windows hosts, akin to unix
sockets for Linux hosts. This should become the default transport
for Windows, but this change does not yet do that.

It also does not add support for the client side yet since that
code is in engine-api, which will have to be revendored separately.

Signed-off-by: John Starks <jostarks@microsoft.com>
2017-05-15 11:57:17 +02:00
David Calavera d611dc46c0 Allow to set daemon and server configurations in a file.
Read configuration after flags making this the priority:

1- Apply configuration from file.
2- Apply configuration from flags.

Reload configuration when a signal is received, USR2 in Linux:

- Reload router if the debug configuration changes.
- Reload daemon labels.
- Reload cluster discovery.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2017-05-15 11:57:17 +02:00
Daniel Nephin e73db35cbf Move some validators from opts to runconfig/opts.
These validators are only used by runconfig.Parse() or some other part of the
client, so move them into the client-side package.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-15 11:57:17 +02:00
Daniel Nephin cef8b71ff4 Move ulimit options to runconfig opts
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-15 11:57:17 +02:00
Daniel Nephin 5d99388c23 Move runconfig blkiodev options and parsing into runconfig/opts package.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-15 11:57:17 +02:00
David Calavera 757d284759 Move blkiodev package to types.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2017-05-15 11:57:17 +02:00
Ma Shimiao 369f057818 Add support for blkio read/write iops device
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2017-05-15 11:57:17 +02:00
Daniel Nephin 659fac261b Move ParseLink and validators into runconfig.parse where they are used.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-15 11:57:16 +02:00
David Calavera bfba6ec070 Replace pkg/units with docker/go-units.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2017-05-15 11:57:16 +02:00
Daniel Nephin 7dc7bff9a0 Move ParseDockerDaemonHost to opts/ package.
This function was only being used from a single place opts/opts.go. This
change moves it from a incohesive package (parsers) to the single place it
is used.

Also made a bunch of the helper methods private because they are not used
by any external modules.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-15 11:57:16 +02:00
Justas Brazauskas f599afe64e Fix typos found across repository
Signed-off-by: Justas Brazauskas <brazauskasjustas@gmail.com>
2017-05-15 11:57:16 +02:00
Ma Shimiao 02a6d3c5e6 Add support for blkio read/write bps device
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2017-05-15 11:57:16 +02:00
David Calavera 9837646cd1 Move Container to its own package.
So other packages don't need to import the daemon package when they
want to use this struct.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Signed-off-by: Tibor Vass <tibor@docker.com>
2017-05-15 11:57:16 +02:00
Ma Shimiao 35c223629b opts/weightdevice: fix typo
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2017-05-15 11:57:16 +02:00
Ma Shimiao 8a67a18fd8 Add support for blkio.weight_device
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2017-05-15 11:57:16 +02:00
David Calavera 8c734c8cde Use an empty slice as default value for DNS, DNSSearch and DNSOptions
So we don't print those <no value> in the client and we don't fail
executing inspect templates with API field names.

Make sure those fields are initialized as empty slices when
a container is loaded from disk and their values are nil.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2017-05-15 11:57:16 +02:00
John Howard d02ac2a694 Windows [TP4] localhost mitigation
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-05-15 11:57:16 +02:00
Shijiang Wei 36030a9a8b Add ability to add multiple tags with docker build
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2017-05-15 11:57:15 +02:00
John Howard af6e545164 Windows: Add volume support
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-05-15 11:57:15 +02:00
Lei Jitang 74d0203af0 Make default tls host work
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2017-05-15 11:57:15 +02:00
Doug Davis 1398bd9861 Remove used param on ParseHost
The first param on opts.ParseHost() wasn't being used for anything.

Once we get rid of that param we can then also clean-up some code
that calls ParseHost() because the param that was passed in wasn't
being used for anything else.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2017-05-15 11:57:15 +02:00
Sven Dowideit 6ad0875074 Default the tcp port to 2376 if tls is on, and 2375 if not
Refactor so that the Host flag validation doesn't destroy the user's input,
and then post process the flags when we know the TLS options

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-05-15 11:57:15 +02:00
Vincent Demeester aca36e11f2 Revert environment regexp from 13694
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-05-15 11:57:15 +02:00
Ma Shimiao 863be38db7 opts/opts.go: fix typo
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2017-05-15 11:57:15 +02:00
Sven Dowideit 2d2863ebd5 Change ParseTCPAddr to use tcp://127.0.0.0:2375 format as default consistently
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-05-15 11:57:15 +02:00
Vincent Demeester 59ffb24c8f Finish linting opts and trust package.
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-05-15 11:57:15 +02:00
Sevki Hasirci 1c5cd03b1b golint: trust
contributes to #14756

Signed-off-by: Sevki Hasirci <s@sevki.org>
2017-05-15 11:57:15 +02:00
Sevki Hasirci 409920de5c Opts lint issues, ip and ulimit
Signed-off-by: Sevki Hasirci <s@sevki.org>
2017-05-15 11:57:15 +02:00
Brian Goff f2934dbacf Add volume API/CLI
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-05-15 11:57:14 +02:00
Qiang Huang 22e1ac4966 Add mode check for device
This fixes two problems:
1. docker run --device /dev/sda:rw ubuntu bash doesn't work
2. --device /dev/zero:/dev/noro:ro doesn't show clear error message,
but fail when writing to cgroup file.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2017-05-15 11:57:14 +02:00
Qiang Huang 6a31056ff6 Change return value for ValidateMountMode
1. rename it from ValidateMountMode to ValidMountMode
Because it's a function simply check mount mode is valid or not.
2. remove the rw check return value
It's not supposed to be combined into this function, and we already
have a function for that check.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2017-05-15 11:57:14 +02:00
Matt Robenolt 869e08a12b opts/envfile: trim all leading whitespace in a line
Signed-off-by: Matt Robenolt <matt@ydekproductions.com>
2017-05-15 11:57:14 +02:00
Qiang Huang 091f800069 Change all docker -d to docker daemon
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2017-05-15 11:57:14 +02:00
Antonio Murdaca 351ac873e0 Remove unused functions
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2017-05-15 11:57:14 +02:00
Shishir Mahajan f3841a1d27 Add and modify tests for legacy and new daemon invokations
Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
Signed-off-by: Tibor Vass <tibor@docker.com>
2017-05-15 11:57:14 +02:00
Tibor Vass f55d8241cf cli: new daemon command and new cli package
This patch creates a new cli package that allows to combine both client
and daemon commands (there is only one daemon command: docker daemon).

The `-d` and `--daemon` top-level flags are deprecated and a special
message is added to prompt the user to use `docker daemon`.

Providing top-level daemon-specific flags for client commands result
in an error message prompting the user to use `docker daemon`.

This patch does not break any old but correct usages.

This also makes `-d` and `--daemon` flags, as well as the `daemon`
command illegal in client-only binaries.

Signed-off-by: Tibor Vass <tibor@docker.com>
2017-05-15 11:57:14 +02:00
Vincent Demeester 7b9ceadc4d Add test coverage to opts and refactor
- Refactor opts.ValidatePath and add an opts.ValidateDevice
  ValidePath will now accept : containerPath:mode, hostPath:containerPath:mode
  and hostPath:containerPath.
  ValidateDevice will have the same behavior as current.

- Refactor opts.ValidateEnv, opts.ParseEnvFile
  Environment variables will now be validated with the following
  definition :
  > Environment variables set by the user must have a name consisting
  > solely of alphabetics, numerics, and underscores - the first of
  > which must not be numeric.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-05-15 11:57:14 +02:00
Matthieu Hauglustaine f49f44a3a3 Add unit tests for ParseEnvFile.
Add unit tests of the ParseEnvFile function. Test for:
* good file
* empty file
* non existent file
* badly formatted file

Signed-off-by: Matthieu Hauglustaine <matt.hauglustaine@gmail.com>
2017-05-15 11:57:14 +02:00
Matthieu Hauglustaine 0ede41afbd Return bufio error if set in ParseEnvFile
Return an error value if bufio failed to properly read a token.
Avoids running a container with partial environment.

Fixes: #14266

Signed-off-by: Matthieu Hauglustaine <matt.hauglustaine@gmail.com>
2017-05-15 11:57:14 +02:00
Eric-Olivier Lamey 0c721e1ad5 Display empty string instead of <nil> when IP opt is nil.
Fixes #13878.

Signed-off-by: Eric-Olivier Lamey <eo@lamey.me>
2017-05-15 11:57:13 +02:00
Doug Davis d1be0bd11e Minor doc edit to add clarity around the --volume path format
Also add a comment to the ValidatePath func so devs/reviewers
know exactly what its looking for.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2017-05-15 11:57:13 +02:00
Doug Davis 292e38a144 Remove duplicate call to net.ParseIP
and a little cleanup

Signed-off-by: Doug Davis <dug@us.ibm.com>
2017-05-15 11:57:13 +02:00
Antonio Murdaca 51c5706326 Add syslog-address log-opt
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2017-05-15 11:57:13 +02:00
Antonio Murdaca e8e6124050 Allow links to be specified with only the name if this matches the alias
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2017-05-15 11:57:13 +02:00