Commit graph

524 commits

Author SHA1 Message Date
John Howard
755be795b4 Move directive out of globals
Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-07-26 10:35:33 -07:00
Brian Goff
df167d3ff0 Fix issue with test ordering for TestParseWords
`TestParseWords` needs to use the `tokenEscape` for one of the test
cases, but `tokenEscape` was not being set unless tests ran in a
specific order.
This sets a default value for `tokenEscape`... `\`... so that tests that
rely on this global are not affected by test ordering.

This is the simplest fix for these cases. Ideally the token should not
be set as a global but rather passed down, which is a much larger
change.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-07-26 10:50:12 -04:00
Yong Tang
35418c1455 Add hint of progress to the output of docker build
This fix tries to address the issue raised in 24912 where docker
build only consists of the current step without overall total steps.

This fix adds the overall total steps so that end user could follow
the progress of the docker build.

An additonal test has been added to cover the changes.

This fix fixes 24912.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-07-24 08:13:58 -07:00
Tomasz Kopczynski
9408b205f5 Builder dispatchers unit tests
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-07-12 07:40:25 +02:00
Sebastiaan van Stijn
6167a9ab16 Merge pull request #22868 from Microsoft/jjh/dockerfilecmd
Windows: CMD not honouring arg escaping
2016-07-07 09:21:26 -07:00
Vincent Demeester
6daf3d2a78
Validate hostname starting from 1.24 API.
In order to keep a little bit of "sanity" on the API side, validate
hostname only starting from v1.24 API version.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-07-06 09:13:59 +02:00
Shev Yan
11280665b4 Dockerfile's comments for "Run the test suite" are out of date because there is no 'test' in hack/make directory.
Signed-off-by: Shev Yan <yandong_8212@163.com>
2016-07-04 22:43:53 +08:00
Otto Kekäläinen
644a7426cc Fix spelling in comments, strings and documentation
Signed-off-by: Otto Kekäläinen <otto@seravo.fi>
2016-07-03 20:58:11 +03:00
danf
29b6a69660 Fix Malformed history layer - missing Sprintf in append of shell in Builder run config
Signed-off-by: Dan Feldman <danf@jfrog.com>
2016-06-28 11:09:39 +03:00
Tomasz Kopczynski
5ece81a72a Builder/dockerfile/dispatchers.go tests
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-06-19 14:45:34 +02:00
John Howard
d05d0211bc Windows: CMD not honouring arg escaping
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-06-15 16:46:32 -07:00
Vincent Demeester
e08aed59df Merge pull request #23322 from tkopczynski/20784-builder-dockerfile-symlink
Reimplement integration test for symlink Dockerfile as a unit test
2016-06-15 10:52:49 +02:00
Tomasz Kopczynski
830584b011 Reimplement integration test for symlink Dockerfile as a unit test
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-06-14 23:07:19 +02:00
Vincent Demeester
7d988a7aa6 Merge pull request #23093 from tkopczynski/20784-builder-dockerfile-outside-context
Builder integration tests for Dockerfile outside context as a unit test
2016-06-14 08:44:24 +02:00
Tiffany Jernigan
a07c57f656 Fixed spelling error in builder/dockerfile/parser/parser.go
Signed-off-by: Tiffany Jernigan <tiffany.f.j@gmail.com>
2016-06-09 14:49:59 -07:00
Jonathan Stoppani
6284f04a6b
Support unicode characters in parseWords
Signed-off-by: Jonathan Stoppani <jonathan.stoppani@divio.com>
2016-06-08 14:05:08 +02:00
Vincent Demeester
df1dd1322d Merge pull request #22489 from Microsoft/jjh/shell
Builder shell configuration
2016-06-05 17:43:12 +02:00
Tomasz Kopczynski
fb175bb367 Reimplementing builder tests for Dockerfile outside context as a unit test
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-06-05 08:39:06 +02:00
Vincent Demeester
3db23a4eaf Merge pull request #23232 from thaJeztah/update-default-retries
Healthcheck: set default retries to 3
2016-06-04 07:50:04 +02:00
John Howard
b18ae8c9cc Builder default shell
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-06-03 13:54:31 -07:00
Yong Tang
ea86320fcc Skip UTF-8 BOM bytes from Dockerignore if exist
This fix tries to address issues related to #23221 where Dockerignore
may consists of UTF-8 BOM. This likely happens when Notepad
tries to save a file as UTF-8 in Windows.

This fix skips the UTF-8 BOM bytes from the beginning of the
Dockerignore if exists.

Additional tests has been added to cover the changes in this fix.

This fix is related to #23221 (UTF-8 BOM in Dockerfile).

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-03 07:26:36 -07:00
Yong Tang
678c80f925 Skip UTF-8 BOM bytes from Dockerfile if exists
This fix tries to address issues in #23221 where Dockerfile
may consists of UTF-8 BOM. This likely happens when Notepad
tries to save a file as UTF-8 in Windows.

This fix skips the UTF-8 BOM bytes from the beginning of the
Dockerfile if exists.

Additional tests has been added to cover the changes in this
fix.

This fix fixes #23221.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-03 06:16:50 -07:00
Sebastiaan van Stijn
50e470fab4
Healthcheck: set default retries to 3
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-06-03 13:28:08 +02:00
Yong Tang
8913dace34 Add support for comment in .dockerignore
This fix tries to address the issue raised in #20083 where
comment is not supported in `.dockerignore`.

This fix updated the processing of `.dockerignore` so that any
lines starting with `#` are ignored, which is similiar to the
behavior of `.gitignore`.

Related documentation has been updated.

Additional tests have been added to cover the changes.

This fix fixes #20083.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-02 19:06:52 -07:00
Thomas Leonard
b6c7becbfe
Add support for user-defined healthchecks
This PR adds support for user-defined health-check probes for Docker
containers. It adds a `HEALTHCHECK` instruction to the Dockerfile syntax plus
some corresponding "docker run" options. It can be used with a restart policy
to automatically restart a container if the check fails.

The `HEALTHCHECK` instruction has two forms:

* `HEALTHCHECK [OPTIONS] CMD command` (check container health by running a command inside the container)
* `HEALTHCHECK NONE` (disable any healthcheck inherited from the base image)

The `HEALTHCHECK` instruction tells Docker how to test a container to check that
it is still working. This can detect cases such as a web server that is stuck in
an infinite loop and unable to handle new connections, even though the server
process is still running.

When a container has a healthcheck specified, it has a _health status_ in
addition to its normal status. This status is initially `starting`. Whenever a
health check passes, it becomes `healthy` (whatever state it was previously in).
After a certain number of consecutive failures, it becomes `unhealthy`.

The options that can appear before `CMD` are:

* `--interval=DURATION` (default: `30s`)
* `--timeout=DURATION` (default: `30s`)
* `--retries=N` (default: `1`)

The health check will first run **interval** seconds after the container is
started, and then again **interval** seconds after each previous check completes.

If a single run of the check takes longer than **timeout** seconds then the check
is considered to have failed.

It takes **retries** consecutive failures of the health check for the container
to be considered `unhealthy`.

There can only be one `HEALTHCHECK` instruction in a Dockerfile. If you list
more than one then only the last `HEALTHCHECK` will take effect.

The command after the `CMD` keyword can be either a shell command (e.g. `HEALTHCHECK
CMD /bin/check-running`) or an _exec_ array (as with other Dockerfile commands;
see e.g. `ENTRYPOINT` for details).

The command's exit status indicates the health status of the container.
The possible values are:

- 0: success - the container is healthy and ready for use
- 1: unhealthy - the container is not working correctly
- 2: starting - the container is not ready for use yet, but is working correctly

If the probe returns 2 ("starting") when the container has already moved out of the
"starting" state then it is treated as "unhealthy" instead.

For example, to check every five minutes or so that a web-server is able to
serve the site's main page within three seconds:

    HEALTHCHECK --interval=5m --timeout=3s \
      CMD curl -f http://localhost/ || exit 1

To help debug failing probes, any output text (UTF-8 encoded) that the command writes
on stdout or stderr will be stored in the health status and can be queried with
`docker inspect`. Such output should be kept short (only the first 4096 bytes
are stored currently).

When the health status of a container changes, a `health_status` event is
generated with the new status. The health status is also displayed in the
`docker ps` output.

Signed-off-by: Thomas Leonard <thomas.leonard@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-06-02 23:58:34 +02:00
Tonis Tiigi
81d24e754d Fix directory walker error checking
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-05-26 14:59:38 -07:00
Arnaud Porterie
8e924153e2 Merge pull request #22268 from Microsoft/jjh/continuationescape
Support platform semantic file paths through ESCAPE
2016-05-26 10:00:56 -07:00
Alex Ellis
86d48aa111 Typo fix wiildcard -> wildcard
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2016-05-22 18:39:35 +01:00
Tomasz Kopczynski
cf2611f323 Reimplementing more builder integration tests as unit tests
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-05-22 01:00:57 +02:00
John Howard
e8e3dd32c5 Support platform file paths through escape
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-05-20 20:29:59 -07:00
Wendel Fleming
131161bbc7 builder: fixed workdir comment
Signed-off-by: Wendel Fleming <wfleming@usc.edu>
2016-05-19 15:40:46 -05:00
Sebastiaan van Stijn
9de21de453 Merge pull request #22462 from Microsoft/jjh/22181unittests
Windows: Reduce CLI time, move some to unit tests
2016-05-13 00:27:29 +02:00
Tomasz Kopczynski
18eeb39985 Reimplementing builder integration tests as unit tests
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-05-11 22:13:39 +02:00
Vincent Demeester
16d0a89593 Merge pull request #22485 from tkopczynski/test-utils
Builder unit tests refactoring
2016-05-06 22:05:02 +02:00
John Howard
faab71701f Windows: Reduce CLI time, move some to unit tests
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-05-06 12:26:08 -07:00
John Howard
6b5c83bf18 Windows: Support ARG in builder
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-05-04 14:32:23 -07:00
Tomasz Kopczynski
ab2baf08f0 Builder unit tests refactoring
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-05-03 19:00:35 +02:00
Tomasz Kopczynski
e00ad7227e Unit test for builder/remote.go
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-05-03 10:20:10 +02:00
Michael Crosby
2b97201e0c Merge pull request #22181 from Microsoft/jjh/workdir
Windows: Consistent build workdir handling
2016-04-26 16:51:09 -07:00
John Howard
0433801093 Windows: Consistent build workdir handling
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-04-26 15:32:52 -07:00
Yong Tang
5844736c14 Labels set on the command line always override labels in Dockerfile
This fix tries to address the inconsistency in #22036 where labels
set on the command line will not override labels specified in
Dockerfile, but will override labels inherited from `FROM` images.

The fix add a LABEL with command line options at the end of the
processed Dockerfile so that command line options labels always
override the LABEL in Dockerfiles (or through `FROM`).

An integration test has been added for test cases specified in #22036.

This fix fixes #22036.

NOTE: Some changes are from #22266 (@tiborvass).

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-04-23 18:49:17 -07:00
Vincent Demeester
27dd6a10b8 Merge pull request #21817 from tkopczynski/20784-builder-dockerfile-support
Unit tests for builder/dockerfile/support
2016-04-16 13:34:35 +02:00
Tomasz Kopczynski
d0ebc58b9c Unit tests for builder/dockerfile/support
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-04-16 00:19:58 +02:00
Tibor Vass
c60c3045dd Merge pull request #21633 from tkopczynski/20784-builder-tarsum-tests
Builder/tarsum unit tests
2016-04-15 12:53:07 -04:00
Tõnis Tiigi
1a14bbc61e Merge pull request #21726 from aaronlehmann/tarsum-filename-normalization
Fix build cache false positives when build context tar contains unnormalized paths
2016-04-15 09:45:26 -07:00
Aaron Lehmann
8691a77e44 Fix build cache false positives when build context tar contains unnormalized paths
If a build context tar has path names of the form 'x/./y', they will be
stored in this unnormalized form internally by tarsum. When the builder
walks the untarred directory tree and queries hashes for each relative
path, it will query paths of the form 'x/y', and they will not be found.

To correct this, have tarsum normalize path names by calling Clean.

Add a test to detect this caching false positive.

Fixes #21715

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-04-14 17:57:45 -07:00
Tõnis Tiigi
73ac6d199c Move build endpoint handler from daemon (#21972)
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-04-13 10:21:00 -07:00
Brian Goff
681b5e0ed4 Merge pull request #21867 from calavera/remove_reference_from_api
Remove reference package dependency from the api.
2016-04-07 21:56:43 -04:00
Brian Goff
3e14070c88 Merge pull request #21815 from Microsoft/jjh/fixunittest
Windows: Fix failing unit tests
2016-04-07 21:14:42 -04:00
David Calavera
47afe6bd0a Remove reference package dependency from the api.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-04-07 15:01:23 -07:00
John Howard
ccd0da908a Windows: Fix failing unit tests
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-04-06 13:42:15 -07:00
John Howard
331c8a86d4 Windows: Remove TP4 support from main code
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-04-06 12:12:20 -07:00
John Howard
f3da0c9055 Merge pull request #21669 from msabansal/expose
Enabling expose support for Windows TP5
2016-04-06 07:52:07 -07:00
msabansal
4982a732f3 Enabling expose support for Windows TP5
Signed-off-by: msabansal <sabansal@microsoft.com>
2016-03-30 17:25:41 -07:00
David Calavera
1a85c8ebbe Apply build labels to images with only a FROM tag.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-03-30 17:28:13 -04:00
Tibor Vass
8dabc0c39b Merge pull request #21574 from tkopczynski/20784-builder-context-tests
Builder/context unit tests
2016-03-30 14:04:51 -04:00
Tomasz Kopczynski
61ca9cc99e Builder/tarsum unit tests
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-03-30 06:40:40 +02:00
Tomasz Kopczynski
555d8cb293 Dockerignore tests
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-03-28 22:31:35 +02:00
Tomasz Kopczynski
593e29156d Builder/context unit tests
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-03-28 13:47:19 +02:00
allencloud
6983f05b42 fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-03-26 22:06:45 +08:00
Alexander Morozov
f2401a0f69 builder: replace cancelled channel with net/context
Also stop execution of run immediately if request was cancelled.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-03-25 08:19:29 -07:00
Sebastiaan van Stijn
5ef04b1c6d Merge pull request #21268 from calavera/remove_dockerfile_from_api
Remove dockerfile dependency from the API.
2016-03-23 19:34:21 -07:00
Tibor Vass
53d2e5e9d7 Merge pull request #21270 from ehazlett/resource-labels
Add Label support for Images (build), Networks and Volumes on Creation
2016-03-22 15:12:33 -04:00
Evan Hazlett
fc214b4408 add label support for build, networks and volumes
build: implement --label

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

network: allow adding labels on create

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

volume: allow adding labels on create

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

add tests for build, network, volume

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

vendor: libnetwork and engine-api bump

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2016-03-22 11:49:06 -04:00
Aaron Lehmann
c44e7a3e63 Pass upstream client's user agent through to registry on operations beyond pulls
This adds support for the passthrough on build, push, login, and search.

Revamp the integration test to cover these cases and make it more
robust.

Use backticks instead of quoted strings for backslash-heavy string
contstands.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-03-21 14:31:47 -07:00
Jessica Frazelle
0e025b4bb1
fix variables that werent being called
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2016-03-17 13:19:55 -07:00
Jessica Frazelle
8dd88afb5b
remove dead code
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2016-03-16 19:15:14 -07:00
David Calavera
93e02efa90 Remove dockerfile dependency from the API.
Move context parsing to the backend.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-03-16 22:06:29 -04:00
Antonio Murdaca
bb05c18892 daemon: update: check len inside public function
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-03-15 17:24:25 +01:00
Antonio Murdaca
59648fc1e9 *: remove unused stuff
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-03-14 18:41:30 +01:00
Qiang Huang
53b0d62683 Vendor engine-api to 70d266e96080e3c3d63c55a4d8659e00ac1f7e6c
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-02-29 19:28:37 +08:00
David Calavera
a793564b25 Remove static errors from errors package.
Moving all strings to the errors package wasn't a good idea after all.

Our custom implementation of Go errors predates everything that's nice
and good about working with errors in Go. Take as an example what we
have to do to get an error message:

```go
func GetErrorMessage(err error) string {
	switch err.(type) {
	case errcode.Error:
		e, _ := err.(errcode.Error)
		return e.Message

	case errcode.ErrorCode:
		ec, _ := err.(errcode.ErrorCode)
		return ec.Message()

	default:
		return err.Error()
	}
}
```

This goes against every good practice for Go development. The language already provides a simple, intuitive and standard way to get error messages, that is calling the `Error()` method from an error. Reinventing the error interface is a mistake.

Our custom implementation also makes very hard to reason about errors, another nice thing about Go. I found several (>10) error declarations that we don't use anywhere. This is a clear sign about how little we know about the errors we return. I also found several error usages where the number of arguments was different than the parameters declared in the error, another clear example of how difficult is to reason about errors.

Moreover, our custom implementation didn't really make easier for people to return custom HTTP status code depending on the errors. Again, it's hard to reason about when to set custom codes and how. Take an example what we have to do to extract the message and status code from an error before returning a response from the API:

```go
	switch err.(type) {
	case errcode.ErrorCode:
		daError, _ := err.(errcode.ErrorCode)
		statusCode = daError.Descriptor().HTTPStatusCode
		errMsg = daError.Message()

	case errcode.Error:
		// For reference, if you're looking for a particular error
		// then you can do something like :
		//   import ( derr "github.com/docker/docker/errors" )
		//   if daError.ErrorCode() == derr.ErrorCodeNoSuchContainer { ... }

		daError, _ := err.(errcode.Error)
		statusCode = daError.ErrorCode().Descriptor().HTTPStatusCode
		errMsg = daError.Message

	default:
		// This part of will be removed once we've
		// converted everything over to use the errcode package

		// FIXME: this is brittle and should not be necessary.
		// If we need to differentiate between different possible error types,
		// we should create appropriate error types with clearly defined meaning
		errStr := strings.ToLower(err.Error())
		for keyword, status := range map[string]int{
			"not found":             http.StatusNotFound,
			"no such":               http.StatusNotFound,
			"bad parameter":         http.StatusBadRequest,
			"conflict":              http.StatusConflict,
			"impossible":            http.StatusNotAcceptable,
			"wrong login/password":  http.StatusUnauthorized,
			"hasn't been activated": http.StatusForbidden,
		} {
			if strings.Contains(errStr, keyword) {
				statusCode = status
				break
			}
		}
	}
```

You can notice two things in that code:

1. We have to explain how errors work, because our implementation goes against how easy to use Go errors are.
2. At no moment we arrived to remove that `switch` statement that was the original reason to use our custom implementation.

This change removes all our status errors from the errors package and puts them back in their specific contexts.
IT puts the messages back with their contexts. That way, we know right away when errors used and how to generate their messages.
It uses custom interfaces to reason about errors. Errors that need to response with a custom status code MUST implementent this simple interface:

```go
type errorWithStatus interface {
	HTTPErrorStatusCode() int
}
```

This interface is very straightforward to implement. It also preserves Go errors real behavior, getting the message is as simple as using the `Error()` method.

I included helper functions to generate errors that use custom status code in `errors/errors.go`.

By doing this, we remove the hard dependency we have eeverywhere to our custom errors package. Yes, you can use it as a helper to generate error, but it's still very easy to generate errors without it.

Please, read this fantastic blog post about errors in Go: http://dave.cheney.net/2014/12/24/inspecting-errors

Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-26 15:49:09 -05:00
Stefan Weil
2eee613326 Fix some typos in comments and strings
Most of them were found and fixed by codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-02-22 20:27:15 +01:00
Antonio Murdaca
d266142230 runconfig: opts: parse: lowercase errors
also fix wrong function comment

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-02-18 11:21:44 +01:00
Vincent Demeester
312f5e435b Move getContext… function to builder package
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-02-11 20:59:59 +01:00
John Howard
d4b0732499 Windows: Fix 'isolation'
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-02-10 13:19:19 -08:00
David Calavera
e18eb6ef39 Merge pull request #20165 from vdemeester/move-validatecontextdirectory-to-builder
Move validateContextDirectory to builder package.
2016-02-10 08:35:25 -08:00
Vincent Demeester
fc6122a947 Move validateContextDirectory to builder package.
This feels like it's where it belongs and it makes it exported
again (which is needed for libcompose that was using it before 1.10).

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-02-09 22:19:09 +01:00
Brian Goff
a77b7dd227 cleanup attach api calls
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-02-09 14:26:51 -05:00
Anusha Ragunathan
691555fc8b Fix ReadAll to run on Windows.
filepath.Clean converts filenames to filenames with native path
separators. Use ToSlash to normalize.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-02-04 14:01:17 -08:00
Anusha Ragunathan
9c332b164f Remove package daemonbuilder.
Currently, daemonbuilder package (part of daemon) implemented the
builder backend. However, it was a very thin wrapper around daemon
methods and caused an implementation dependency for api/server build
endpoint. api/server buildrouter should only know about the backend
implementing the /build API endpoint.

Removing daemonbuilder involved moving build specific methods to
respective files in the daemon, where they fit naturally.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-02-01 09:57:38 -08:00
Arnaud Porterie
46018c3cee Merge pull request #19837 from cpuguy83/carry_19085
Carry 19085 -- Improve & cleanup documentation comments
2016-01-29 14:30:25 -08:00
Brian Goff
9c09a79ba5 update doc string
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-01-29 15:25:25 -05:00
Anusha Ragunathan
14215ed5a1 Make daemonbuilder.Docker leaner.
Currently builder.Backend is implemented by daemonbuilder.Docker{} for
the daemon. This registration happens in the API/server code. However,
this is too implementation specific. Ideally we should be able to specify
that docker daemon (or any other) is implementing the Backend and abstract
the implementation details. So we should remove package daemonbuilder
dependency in build_routes.go

With this change, daemonbuilder.Docker is nothing more than the daemon.
A follow on change will remove the daemonbuilder package and move relevant
methods under daemon, so that API only knows about the backend.

Also cleanup code in api/client/build.go. docker cli always performs build
context tar download for remoteURLs and sends an empty remoteContext. So
remove relevant dead code.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-01-18 09:16:11 -08:00
Lukas Waslowski
a4ce361ac8 Improve docs for Daemon.TagImage and dockerfile.BuildFromConfig.
Signed-off-by: Lukas Waslowski <cr7pt0gr4ph7@gmail.com>
2016-01-08 14:51:09 +01:00
David Calavera
907407d0b2 Modify import paths to point to the new engine-api package.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-06 19:48:59 -05:00
Doug Davis
d3ea7e80e8 Add default PATH to 'scratch' images
Closes #19012

Signed-off-by: Doug Davis <dug@us.ibm.com>
2016-01-06 09:50:35 -08:00
John Howard
1094542c4c Windows: Fix build not to sigsegv
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-01-05 16:08:04 -08:00
Tibor Vass
df9a3d1005 Merge pull request #19092 from anusha-ragunathan/builder-rm-merge
Remove runconfig.Merge
2016-01-05 15:21:24 -05:00
Anusha Ragunathan
eb4ae8e28a Remove runconfig.Merge
Merge was used by builder and daemon. With this commit, the builder
call has been inlined and the function moved to the daemon package,
which is the only other caller.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-01-05 11:28:55 -08:00
Anusha Ragunathan
5190794f1d Use ImageBuildOptions in builder.
dockerfile.Config is almost redundant with ImageBuildOptions.
Unify the two so that the latter can be removed. This also
helps build's API endpoint code to be less dependent on package
dockerfile.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-01-05 10:09:34 -08:00
Daniel Nephin
2b7ad47bd2 Move the runconfig.Parse() function into the runconfig/opts package.
The parse.go file is used almost exclusively in the client. The few small
functions that are used outside of the client could easily be copied out
when the client is extracted, allowing this runconfig/opts package to
move to the client.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-01-04 12:06:29 -05:00
Doug Davis
e6806223e8 Use constant instead of "scratch"
Move NoBaseImageSpecifier to a common spot and then use it instead of
"scratch" in a couple of places.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-12-31 06:21:56 -08:00
Daniel Nephin
6dba0b5d89 Remove the need for runconfig.Parse() in the builder.
By using a container.Config directly.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-12-27 19:58:51 -05:00
Daniel Nephin
83237aab2b Remove package pkg/ulimit, use go-units instead.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-12-23 13:27:58 -05:00
David Calavera
7ac4232e70 Move Config and HostConfig from runconfig to types/container.
- Make the API client library completely standalone.
- Move windows partition isolation detection to the client, so the
  driver doesn't use external types.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-22 13:34:30 -05:00
David Calavera
056e744903 Replace usage of pkg/nat with go-connections/nat.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-22 13:31:46 -05:00
David Calavera
f9b857a200 Move StrSlice to types.
This is a very docker concept that nobody elses need.
We only maintain it to keep the API backwards compatible.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-22 13:31:43 -05:00
Boaz Shuster
60b4db7eb1 Change the quiet flag behavior in the build command
Right now, the quiet (-q, --quiet) flag ignores the output
generated from within the container.

However, it ought to be quiet in a way that all kind
of diagnostic output should be ignored, unless the build
process fails.

This patch makes the quiet flag behave in the following way:
 1. If the build process succeeds, stdout contains the image ID
    and stderr is empty.
 2. If the build process fails, stdout is empty and stderr
    has the error message and the diagnostic output of that process.

If the quiet flag is not set, then everything goes to stdout
and error messages, if there are any, go to stderr.

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
2015-12-21 16:38:50 +02:00
Antonio Murdaca
92605b823d Merge pull request #18761 from anusha-ragunathan/add-build-routes
Create build router separate from image router.
2015-12-18 21:09:43 +01:00