Commit graph

326 commits

Author SHA1 Message Date
John Howard
9cd84e405d Windows: Regression re-fix builder
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-10-07 15:57:37 -07:00
Tibor Vass
e0ef11a4c2 Abstract builder and implement server-side dockerfile builder
This patch creates interfaces in builder/ for building Docker images.
It is a first step in a series of patches to remove the daemon
dependency on builder and later allow a client-side Dockerfile builder
as well as potential builder plugins.

It is needed because we cannot remove the /build API endpoint, so we
need to keep the server-side Dockerfile builder, but we also want to
reuse the same Dockerfile parser and evaluator for both server-side and
client-side.

builder/dockerfile/ and api/server/builder.go contain implementations
of those interfaces as a refactoring of the current code.

Signed-off-by: Tibor Vass <tibor@docker.com>
2015-10-06 19:10:19 -04:00
Tibor Vass
f41230b93a Move builder files to builder/dockerfile
Signed-off-by: Tibor Vass <tibor@docker.com>
2015-10-05 18:26:47 -04:00
Jess Frazelle
134fefbaa2 Merge pull request #16490 from Microsoft/10662-mtimefix
Fixed file modified time not changing on windows
2015-10-02 12:06:03 -07:00
Darren Stahl
40b77af234 Fixed file modified time not changing on Windows
Signed-off-by: Darren Stahl <darst@microsoft.com>
2015-10-01 10:45:32 -07:00
Tibor Vass
b08f071e18 Revert "Merge pull request #16228 from duglin/ContextualizeEvents"
Although having a request ID available throughout the codebase is very
valuable, the impact of requiring a Context as an argument to every
function in the codepath of an API request, is too significant and was
not properly understood at the time of the review.

Furthermore, mixing API-layer code with non-API-layer code makes the
latter usable only by API-layer code (one that has a notion of Context).

This reverts commit de41640435, reversing
changes made to 7daeecd42d.

Signed-off-by: Tibor Vass <tibor@docker.com>

Conflicts:
	api/server/container.go
	builder/internals.go
	daemon/container_unix.go
	daemon/create.go
2015-09-29 14:26:51 -04:00
Tibor Vass
79c31f4b13 Revert "Merge pull request #16567 from calavera/context_per_request"
This reverts commit ff92f45be4, reversing
changes made to 80e31df3b6.

Reverting to make the next revert easier.

Signed-off-by: Tibor Vass <tibor@docker.com>
2015-09-29 13:40:46 -04:00
David Calavera
f0e904df8e Merge pull request #16590 from Microsoft/10662-escapeargsfix
Windows: Flags to cmd are now sent as two separate arguments
2015-09-25 13:29:54 -07:00
Jess Frazelle
ff92f45be4 Merge pull request #16567 from calavera/context_per_request
Define a context per request.
2015-09-25 13:01:51 -07:00
Darren Stahl
5aa7c2317a Flags to cmd are now sent as two separate arguments
This fixes a regression caused by PR #16538.

Signed-off-by: Darren Stahl <darst@microsoft.com>
2015-09-25 10:37:53 -07:00
Morgan Bauer
93bd57b0b2
refactor create to not expose internal data structures
- use existing exposed type

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
2015-09-25 09:35:18 -07:00
Doug Davis
02ae137b1d Merge pull request #16571 from skatsuta/fix-typo-comment-evaluator
builder: fix typos in comments
2015-09-24 23:44:00 -04:00
David Calavera
27c76522de Define a context per request.
Avoid creating a global context object that will be used while the daemon is running.

Not only this object won't ever be garbage collected, but it won't ever be used for anything else than creating other contexts in each request. I think it's a bad practive to have something like this sprawling aroud the code.

This change removes that global object and initializes a context in the cases we don't have already one, like shutting down the server.
This also removes a bunch of context arguments from functions that did nothing with it.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-09-24 18:44:53 -04:00
Doug Davis
26b1064967 Add context.RequestID to event stream
This PR adds a "request ID" to each event generated, the 'docker events'
stream now looks like this:

```
2015-09-10T15:02:50.000000000-07:00 [reqid: c01e3534ddca] de7c5d4ca927253cf4e978ee9c4545161e406e9b5a14617efb52c658b249174a: (from ubuntu) create
```
Note the `[reqID: c01e3534ddca]` part, that's new.

Each HTTP request will generate its own unique ID. So, if you do a
`docker build` you'll see a series of events all with the same reqID.
This allow for log processing tools to determine which events are all related
to the same http request.

I didn't propigate the context to all possible funcs in the daemon,
I decided to just do the ones that needed it in order to get the reqID
into the events. I'd like to have people review this direction first, and
if we're ok with it then I'll make sure we're consistent about when
we pass around the context - IOW, make sure that all funcs at the same level
have a context passed in even if they don't call the log funcs - this will
ensure we're consistent w/o passing it around for all calls unnecessarily.

ping @icecrime @calavera @crosbymichael

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-09-24 11:56:37 -07:00
Soshi Katsuta
53e5f33279 builder: fix typos in comments
Signed-off-by: Soshi Katsuta <soshi.katsuta@gmail.com>
2015-09-25 01:45:59 +09:00
John Howard
b69c13b1a6 Windows: Nice error on ARG (builder)
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-09-21 14:54:15 -07:00
Doug Davis
a283a30fb0 Move api/errors/ to errors/
Per @calavera's suggestion: https://github.com/docker/docker/pull/16355#issuecomment-141139220

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-09-17 11:54:14 -07:00
David Calavera
cfd3080a80 Merge pull request #15898 from Microsoft/15775-buildcontextfix
Windows: Fix long path handling for docker build
2015-09-17 09:19:23 -07:00
Madhav Puri
54240f8da9 Support for passing build-time variables in build context
- The build-time variables are passed as environment-context for command(s)
run as part of the RUN primitve. These variables are not persisted in environment of
intermediate and final images when passed as context for RUN. The build environment
is prepended to the intermediate continer's command string for aiding cache lookups.
It also helps with build traceability. But this also makes the feature less secure from
point of view of passing build time secrets.

- The build-time variables also get used to expand the symbols used in certain
Dockerfile primitves like ADD, COPY, USER etc, without an explicit prior definiton using a
ENV primitive. These variables get persisted in the intermediate and final images
whenever they are expanded.

- The build-time variables are only expanded or passed to the RUN primtive if they
are defined in Dockerfile using the ARG primitive or belong to list of built-in variables.
HTTP_PROXY, HTTPS_PROXY, http_proxy, https_proxy, FTP_PROXY and NO_PROXY are built-in
variables that needn't be explicitly defined in Dockerfile to use this feature.

Signed-off-by: Madhav Puri <madhav.puri@gmail.com>
2015-09-16 03:31:15 -07:00
Stefan J. Wernli
9b648dfac6 Windows: Fix long path handling for docker build
Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
2015-09-15 10:58:11 -07:00
Brian Goff
e91f2c26ce Merge pull request #15069 from duglin/UseErrorPackage
Use the new error package
2015-09-15 09:28:53 -04:00
Doug Davis
628b9a41b0 Use the new error package
This is the first step in converting out static strings into well-defined
error types.  This shows just a few examples of it to get a feel for how things
will look. Once we agree on the basic outline we can then work on converting
the rest of the code over.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-09-14 13:11:01 -07:00
John Howard
8de7fcaf7e Windows: Nice error on stopsignal
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-09-11 09:40:23 -07:00
David Calavera
3781cde61f Add STOPSIGNAL instruction to dockerfiles.
This way, images creators can set the exit signal their programs use.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-09-10 19:56:05 -04:00
Alexander Morozov
0009852cb0 Merge pull request #15877 from Microsoft/10662-trigger
Fix trigger count and output
2015-09-03 20:04:05 -07:00
John Howard
6620102926 Fix trigger count and output
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-09-03 17:39:19 -07:00
Tibor Vass
6ffbea3c94 Merge pull request #16027 from Microsoft/10662-utimes
Windows: Fix dockerfile ADD from HTTP
2015-09-03 18:44:34 -04:00
John Howard
7beb026f0e Windows: Fix HTTP download directory
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-09-02 16:24:53 -07:00
John Howard
3715e60c71 Windows: Fix dockerfile ADD from HTTP
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-09-02 13:53:09 -07:00
John Howard
49c1b51ae2 Windows: Fix absolute checks
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-09-01 08:41:37 -07:00
Shijiang Wei
ea4a06740b abstract the string slice struct to stringutils package
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2015-08-29 01:08:40 +08:00
John Howard
17d6c6c7e5 Builder counts from 1
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-08-26 10:05:04 -07:00
David Calavera
6f8c4480e4 Merge pull request #14665 from coolljt0725/fix_build_with_resource_limit
Fix build with resource limit which system not support.
2015-08-25 16:42:13 +02:00
Doug Davis
eeeae2c235 Add some builder getEnv tests
In particular I want to make sure that calling getEnv() when the same
var name appears more than once in the env list that we only pick up
the first one.  PR #15182 counts on this

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-08-22 13:12:43 -07:00
Soshi Katsuta
d45fcc6c80 integration-cli: add a integration test to avoid parsing null string in ADD, COPY and VOLUME to nil slice
Signed-off-by: Soshi Katsuta <katsuta_soshi@cyberagent.co.jp>
2015-08-19 11:11:46 +09:00
Soshi Katsuta
2d6952e8a5 builder: avoid decoding "null" string in ADD, COPY and VOLUME step to nil slice
Signed-off-by: Soshi Katsuta <katsuta_soshi@cyberagent.co.jp>
2015-08-18 21:15:57 +09:00
Lei Jitang
770daa15f3 Fix build with resource limit which system is not support.
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-08-18 11:54:00 +08:00
David Calavera
2e7b088164 Merge pull request #15579 from Microsoft/10662-graph
Windows: Graph remove custom interface, add central store
2015-08-17 10:45:48 -07:00
Stefan J. Wernli
dfbb5520e3 Windows: Graph remove custom interface and add central store
Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>

Windows: add support for images stored in alternate location.

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
2015-08-14 23:45:53 -07:00
John Howard
6df6e2e405 Windows: Block 'FROM scratch'
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-08-14 18:17:19 -07:00
John Howard
4b933dd2ea Windows: Stop commit on running container
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-08-13 22:17:03 -07:00
John Howard
394ccfac07 Windows: Error on unsupported builder command
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-08-12 10:02:23 -07:00
Veres Lajos
5146232723 typofix - https://github.com/vlajos/misspell_fixer
Signed-off-by: Veres Lajos <vlajos@gmail.com>
2015-08-07 23:25:49 +01:00
Doug Davis
592908c0f5 Just add some code doc around the use of AddXXX func to avoid any confusion
Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-08-07 08:07:27 -07:00
Aaron Lehmann
1f61084d83 Fix uses of "int" where "int64" should be used instead
Some structures use int for sizes and UNIX timestamps. On some
platforms, int is 32 bits, so this can lead to the year 2038 issues and
overflows when dealing with large containers or layers.

Consistently use int64 to store sizes and UNIX timestamps in
api/types/types.go. Update related to code accordingly (i.e.
strconv.FormatInt instead of strconv.Itoa).

Use int64 in progressreader package to avoid integer overflow when
dealing with large quantities. Update related code accordingly.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-31 16:31:40 -07:00
Alexey Guskov
26c03d561a make docker compile on freebsd
Signed-off-by: Alexey Guskov <lexag@mail.ru>
2015-07-29 21:25:56 +03:00
Jessie Frazelle
25c42cc0d0 Merge pull request #14759 from vdemeester/pkg-golint
golint on some pkg/* packages
2015-07-27 15:19:46 -07:00
Vincent Demeester
18c7c67308 Lint on pkg/* packages
- pkg/useragent
- pkg/units
- pkg/ulimit
- pkg/truncindex
- pkg/timeoutconn
- pkg/term
- pkg/tarsum
- pkg/tailfile
- pkg/systemd
- pkg/stringutils
- pkg/stringid
- pkg/streamformatter
- pkg/sockets
- pkg/signal
- pkg/proxy
- pkg/progressreader
- pkg/pools
- pkg/plugins
- pkg/pidfile
- pkg/parsers
- pkg/parsers/filters
- pkg/parsers/kernel
- pkg/parsers/operatingsystem

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-07-27 21:26:21 +02:00
Vincent Demeester
5170a2c096 Lint fixes on runconfig
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-07-27 21:23:15 +02:00
Lei
877dbbbde8 Add ulimit to docker build.
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-07-23 10:26:06 +08:00