Commit graph

168 commits

Author SHA1 Message Date
David Calavera
6bb0d1816a 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>
2015-12-03 17:39:49 +01:00
Ma Shimiao
8d4c0ba274 opts/weightdevice: fix typo
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-11-19 17:03:46 +08:00
Ma Shimiao
0fbfa1449d Add support for blkio.weight_device
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-11-11 23:06:36 +08:00
Tibor Vass
62b484411e Merge pull request #17779 from calavera/fix_dns_regression
Use an empty slice as default value for DNS, DNSSearch and DNSOptions.
2015-11-09 18:07:07 -05:00
David Calavera
f1a74a89f8 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>
2015-11-09 12:46:48 -05:00
John Howard
eb2acb8f0e Windows [TP4] localhost mitigation
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-11-06 13:52:59 -08:00
Tibor Vass
e74cf8acad Merge pull request #16433 from Microsoft/10662-volumes5
Windows: [TP4] Add volume support
2015-10-23 18:43:07 -04:00
Sebastiaan van Stijn
448398c2a8 Merge pull request #15780 from mountkin/build-multi-tags
Add ability to add multiple tags with docker build
2015-10-23 13:50:35 -07:00
Shijiang Wei
c2eb37f9ae Add ability to add multiple tags with docker build
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2015-10-24 00:59:56 +08:00
John Howard
a7e686a779 Windows: Add volume support
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-10-22 10:42:53 -07:00
Lei Jitang
fbb01b8162 Make default tls host work
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-10-19 21:17:37 +08:00
Doug Davis
ba973f2d74 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>
2015-10-11 20:45:17 -07:00
Sven Dowideit
50f0906007 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>
2015-10-09 17:48:03 -07:00
Vincent Demeester
7335544fd0 Revert environment regexp from 13694
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-09-28 20:26:20 +02:00
Ma Shimiao
185544a4fe opts/opts.go: fix typo
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-09-14 14:48:09 +08:00
Sven Dowideit
3d510f15da Change ParseTCPAddr to use tcp://127.0.0.0:2375 format as default consistently
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2015-08-29 11:23:51 +00:00
Vincent Demeester
0bd016b1c3 Finish linting opts and trust package.
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-08-27 17:36:11 +02:00
Sevki Hasirci
5572148477 golint: trust
contributes to #14756

Signed-off-by: Sevki Hasirci <s@sevki.org>
2015-08-27 11:40:27 +02:00
Sevki Hasirci
6eb03c53db Opts lint issues, ip and ulimit
Signed-off-by: Sevki Hasirci <s@sevki.org>
2015-08-27 11:40:27 +02:00
Brian Goff
b3b7eb2723 Add volume API/CLI
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-08-26 13:37:52 -04:00
Alexander Morozov
6b21e98432 Merge pull request #15766 from hqhq/hq_fix_device
Add mode check for device
2015-08-24 10:58:49 -07:00
Qiang Huang
429423624c 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>
2015-08-24 17:57:12 +08:00
Qiang Huang
c99ed5ae5d 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>
2015-08-24 17:28:19 +08:00
Matt Robenolt
f1988f046f opts/envfile: trim all leading whitespace in a line
Signed-off-by: Matt Robenolt <matt@ydekproductions.com>
2015-08-22 09:01:27 -07:00
Qiang Huang
81cc8ebc93 Change all docker -d to docker daemon
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-08-10 20:48:08 +08:00
Antonio Murdaca
0e69318b27 Remove unused functions
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2015-07-25 19:54:05 +02:00
Shishir Mahajan
e7fc632147 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>
2015-07-23 20:31:43 -04:00
Tibor Vass
96ce3a194a 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>
2015-07-23 19:44:46 -04:00
Vincent Demeester
dfc6c04fa3 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>
2015-07-12 10:33:30 +02:00
Matthieu Hauglustaine
0dadf11bec 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>
2015-07-01 17:43:03 +02:00
Matthieu Hauglustaine
e848494017 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>
2015-07-01 17:17:48 +02:00
Eric-Olivier Lamey
9ad89281ae Display empty string instead of <nil> when IP opt is nil.
Fixes #13878.

Signed-off-by: Eric-Olivier Lamey <eo@lamey.me>
2015-06-11 11:14:28 +00:00
Doug Davis
3fcf53db92 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>
2015-06-05 15:11:42 -07:00
Doug Davis
b180de55ca Remove duplicate call to net.ParseIP
and a little cleanup

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-06-05 09:44:10 -07:00
Antonio Murdaca
e8c88d2533 Add syslog-address log-opt
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-05-29 00:42:11 +02:00
Antonio Murdaca
c6e6223ed7 Allow links to be specified with only the name if this matches the alias
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-05-11 21:50:47 +02:00
wlan0
dca9e02b15 Add log opts flag to pass in logging options
Signed-off-by: wlan0 <sidharthamn@gmail.com>
2015-05-04 14:39:48 -07:00
jhowardmsft
cbf9a64cb5 Windows: Change default listener to HTTP
Signed-off-by: jhowardmsft <jhoward@microsoft.com>
2015-04-30 19:49:45 -07:00
Antonio Murdaca
4b9fe9c298 Remove job from container_inspect
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-04-23 00:58:13 +02:00
George MacRorie
664ef0cbe2 Cleanup redundant else statements find via golint #11602
Signed-off-by: George MacRorie <gmacr31@gmail.com>
2015-03-23 20:40:29 +00:00
Tomáš Hrčka
b2f05c2207 Restrict domain name to 255 characters
Signed-off-by: Tomáš Hrčka <thrcka@redhat.com>

Docker-DCO-1.1-Signed-off-by: Jessie Frazelle <princess@docker.com> (github: jfrazelle)
2015-03-09 10:14:56 -07:00
Jessie Frazelle
df7ba57f5f Merge pull request #9437 from cpuguy83/set_rlimits_in_container
Allow setting ulimits for containers
2015-03-04 04:00:17 -08:00
Lei Jitang
2ba0fbb0ae Add validate the input mac address on docker run command
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-02-27 07:27:12 -08:00
Brian Goff
3f39050637 Allow setting ulimits for containers
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-02-25 19:37:43 -05:00
Phil Estes
1ce9fa1c60 Add more helpful error message for -add-host
Fixes: #10655

As noted in the issue, bad format was being returned even if the format
was appropriate, but the IP was invalid.  This adds a better error
message for when the IP address fails validation.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2015-02-09 12:45:50 -05:00
Phil Estes
fdfa205786 Allow IPv6 addresses in ExtraHosts option settings
Since the separator for extra host settings (for /etc/hosts in a
container) is a ":", the code that handles extra hosts needed to only
split on the first ":" to preserve IPv6 addresses which are passed via
the command line settings as well as stored in the JSON container
config.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2015-02-04 10:20:28 -05:00
Doug Davis
9ab73260f8 Docker run -e FOO should erase FOO if FOO isn't set in client env
See #10141 for more info, but the main point of this is to make sure
that if you do "docker run -e FOO ..." that FOO from the current env
is passed into the container.  This means that if there's a value, its
set.  But it also means that if FOO isn't set then it should be unset in
the container too - even if it has to remove it from the env.  So,
   unset HOSTNAME
   docker run -e HOSTNAME busybox env
should _NOT_ show HOSTNAME in the list at all

Closes #10141

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-01-19 08:00:32 -08:00
Don Kjer
568f86eb18 Deprecating ResolveRepositoryName
Passing RepositoryInfo to ResolveAuthConfig, pullRepository, and pushRepository

Moving --registry-mirror configuration to registry config

Created resolve_repository job

Repo names with 'index.docker.io' or 'docker.io' are now synonymous with omitting an index name.

Adding test for RepositoryInfo

Adding tests for opts.StringSetOpts and registry.ValidateMirror

Fixing search term use of repoInfo

Adding integration tests for registry mirror configuration

Normalizing LookupImage image name to match LocalName parsing rules

Normalizing repository LocalName to avoid multiple references to an official image

Removing errorOut use in tests

Removing TODO comment

gofmt changes

golint comments cleanup.  renaming RegistryOptions => registry.Options, and RegistryServiceConfig => registry.ServiceConfig

Splitting out builtins.Registry and registry.NewService calls

Stray whitespace cleanup

Moving integration tests for Mirrors and InsecureRegistries into TestNewIndexInfo unit test

Factoring out ValidateRepositoryName from NewRepositoryInfo

Removing unused IndexServerURL

Allowing json marshaling of ServiceConfig.  Exposing ServiceConfig in /info

Switching to CamelCase for json marshaling

PR cleanup; removing 'Is' prefix from boolean members.  Removing unneeded json tags.

Removing non-cleanup related fix for 'localhost:[port]' in splitReposName

Merge fixes for gh9735

Fixing integration test

Reapplying #9754

Adding comment on config.IndexConfigs use from isSecureIndex

Remove unused error return value from isSecureIndex

Signed-off-by: Don Kjer <don.kjer@gmail.com>

Adding back comment in isSecureIndex

Signed-off-by: Don Kjer <don.kjer@gmail.com>
2015-01-08 20:14:58 +00:00
Victor Vieux
2fe36baa0a add daemon labels
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-11-20 19:23:58 +00:00
Ahmet Alp Balkan
5a38680bd2 Fix input volume path check on Windows
used path package instead of path/filepath so that --volumes and
--device parameters to always validate paths as unix paths instead of
OS-dependent path convention

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
2014-11-14 18:20:54 -08:00
Tim Hockin
68e48b65a6 Allow extra lines in /etc/hosts
This adds a --add-host host:ip flag which appends lines to /etc/hosts.  This is needed in places where you want the container to get a different name resolution than it would through DNS.  This was submitted before as #5525, closed, and now I am re-opening.  It has come up 2 or 3 times in the last couple days.

Signed-off-by: Tim Hockin <thockin@google.com>
2014-09-16 23:38:23 +00:00
Phil Estes
4119c9d7d9 Refactor all pre-compiled regexp to package level vars
Addresses #8057

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2014-09-16 12:57:44 -04:00
Tim Smith
69a75c673c Add daemon flag to specify public registry mirrors
Adds support for a --registry-mirror=scheme://<host>[:port]
daemon flag. The flag may be present multiple times. If
provided, mirrors are prepended to the list of endpoints used
for image pull. Note that only mirrors of the public
index.docker.io registry are supported, and image/tag resolution
is still performed via the official index.

Docker-DCO-1.1-Signed-off-by: Tim Smith <timbot@google.com> (github: timbot)
2014-09-09 19:03:38 +00:00
Solomon Hykes
a30fd7a962 Fix inconsistency in IP address parsing errors
Signed-off-by: Solomon Hykes <solomon@docker.com>
2014-08-13 19:25:51 +00:00
Solomon Hykes
ca11b77471 opts.IPVal returns an error on incorrect input
Signed-off-by: Solomon Hykes <solomon@docker.com>
2014-08-13 19:25:51 +00:00
Solomon Hykes
6200002669 Helpers to parse lists, IPs, hosts, dns searches from the command line
Signed-off-by: Solomon Hykes <solomon@docker.com>
2014-08-13 19:25:47 +00:00
Solomon Hykes
6d59a56675 opts.IpOpt: a helper to parse IP addressed from the command line
Signed-off-by: Solomon Hykes <solomon@docker.com>
2014-08-13 19:09:51 +00:00
Tibor Vass
a713413293 Make --attach case-insensitive
Docker-DCO-1.1-Signed-off-by: Tibor Vass <teabee89@gmail.com> (github: tiborvass)
2014-07-30 15:36:16 -04:00
Erik Hollensbe
4398108433 Move parsing functions to pkg/parsers and the specific kernel handling
functions to pkg/parsers/kernel, and parsing filters to
pkg/parsers/filter. Adjust imports and package references.

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-07-29 13:09:10 -07:00
Victor Vieux
b3ee9ac74e update go import path and libcontainer
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
2014-07-24 22:19:50 +00:00
Victor Vieux
b68111713d update for consistency
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
2014-07-09 21:48:02 +00:00
Jan Pazdziora
899e9e7416 Add support for IPv6 addresses in --dns parameters.
Docker-DCO-1.1-Signed-off-by: Jan Pazdziora <jpazdziora@redhat.com> (github: adelton)
2014-07-09 21:48:02 +00:00
Fabio Falci
804b00cd7d Relax dns search to accept empty domain
In that case /etc/resolv.conf will be generated with no search
option. Usage: --dns-search=.

Docker-DCO-1.1-Signed-off-by: Fabio Falci <fabiofalci@gmail.com> (github: fabiofalci)
2014-07-04 09:33:53 +01:00
Vincent Batts
500c8ba4b6 env-file: variable behavior
trim the front of variables. Error if there are other spaces present.
Leave the value alone.

Docker-DCO-1.1-Signed-off-by: Vincent Batts <vbatts@redhat.com> (github: vbatts)
2014-03-31 14:45:13 -04:00
Vincent Batts
ff4ac7441b --env-file: simple line-delimited
match dock functionality, and not try to achieve shell-sourcing compatibility

Docker-DCO-1.1-Signed-off-by: Vincent Batts <vbatts@redhat.com> (github: vbatts)
2014-03-31 14:45:13 -04:00
Daniel Norberg
c657603c61 variable declaration cleanup
Docker-DCO-1.1-Signed-off-by: Daniel Norberg <daniel.norberg@gmail.com> (github: danielnorberg)
2014-03-19 16:44:11 -04:00
Daniel Norberg
fbfac21ed4 configurable dns search domains
Add a --dns-search parameter and a DnsSearch
configuration field for specifying dns search
domains.

Docker-DCO-1.1-Signed-off-by: Daniel Norberg <daniel.norberg@gmail.com> (github: danielnorberg)
2014-03-19 10:49:25 -04:00
Victor Vieux
fde5f573d3 move opts out of pkg because it's related to docker
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
2014-03-10 21:10:23 +00:00