Commit Graph

150 Commits

Author SHA1 Message Date
dbc9971c4a builder/parser: Make use of builder/command
Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
Upstream-commit: 72a070c5da8b6fe832794a6de37aace7f9b93306
Component: engine
2015-02-11 23:54:41 -08:00
b2dfebba9a Create builder/command, cut libcontainer dependency on integration-cli
d1e9d07c introduces a dependency to libcontainer and other daemon
related packages through builder package. The only thing test needs
is set of the Dockerfile commands. Extracting them to a separate
package.

This was causing CI tests to not to compile on non-Linux platforms.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
Upstream-commit: ccde3a1f73bb4f64845e736d3173eb6f6935971f
Component: engine
2015-02-11 21:44:31 -08:00
b185b43330 Show err msg on empty 'scratch' Dockerfile
If you have a Dockefile with just:
   FROM scratch

An error is generated but its never shown to the CLI. This PR fixes that.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 1654dfdf146df42a1271696c0290027460cce59a
Component: engine
2015-02-10 11:43:45 -08:00
4413092410 Get list of Dockerfile cmds from builder so we can be smarted in our tests
Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: d1e9d07c1b09a145b881a7ee6d58cc2e860167c8
Component: engine
2015-02-08 08:09:02 -08:00
d3182181ac Add support for no-arg commands in Dockerfile
We're hoping to add some new commands that don't have any args so this
PR will enable that by removing all of the hard-coded checks that require
commands to have at least one arg.  It also adds some checks to each
command so we're consistent in the error message we get.  Added a test
for this too.

We actually had this check in at least 3 different places (twice in the
parser and once in most cmds), this removes 2 of them (the parser ones).

Had to remove/modify some testcases because its now legal to have certain
commands w/o args - e.g. RUN. This was actually inconsistent because
we used to allow "RUN []" but not "RUN" even though they would generate
(almost) the same net result.  Now we're consistent.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: e4f02abb51534e560311b0afcfb7b586d9587e67
Component: engine
2015-02-08 03:36:49 -08:00
079f594f83 Merge pull request #10573 from LK4D4/return_attach_to_builder
Change verbose builder out back to attach
Upstream-commit: e345fe53ba1e8f84cef2396e332860a87fcd65da
Component: engine
2015-02-06 14:37:09 -08:00
dfd79f3c67 Merge pull request #9705 from acbodine/9311-truncindex-error-duplicate-id-on-ambiguous-id
Closes #9311 Handles container id/name collisions against daemon functionalities according to #8069
Upstream-commit: 34c804a139cc086e9fa6d3f99442f083b6d5e1e7
Component: engine
2015-02-06 14:01:28 -08:00
eba231efa0 Merge pull request #10120 from duglin/TrimSpaces
Remove leading/trailing spaces in builder/parser
Upstream-commit: 82191cc3f3b3ea49da6287abdb9c2ba6eb6d253c
Component: engine
2015-02-06 16:25:37 -05:00
7b03f17d1a Remove leading/trailing spaces in builder/parser
Per Erikh's suggestion at:
https://github.com/docker/docker/pull/9989#issuecomment-69832009
this PR will trim spaces in the parser to ensure that the user gets the same
results irrespetive of leading/trailing spaces.

Per @tiborvass's suggestion I added a test to make sure spaces in quotes
are not touched.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 3859c485317a395de1e8eb48270d0e3b1207a204
Component: engine
2015-02-06 08:52:18 -08:00
5d5fbc1d01 Change verbose builder out back to attach
This is sort of "revert" of #8415. There is some problems with using
logs:
* Non-live progressbars
* Races when you can try to get logs before it was written(there was
  occasional errors in tests)

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 1095d5e5e43654aa27952f131b71c55f18fedc4b
Component: engine
2015-02-04 15:37:14 -08:00
5bd881552f fix comments typos
s/propogated/propagated

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
Upstream-commit: ef3192f161a89bbff11d88da523be61484a822f2
Component: engine
2015-02-04 10:47:37 +08:00
3ba1373e01 builder: prevent Dockerfile to leave build context
Signed-off-by: Tibor Vass <teabee89@gmail.com>
Upstream-commit: 73d5baf585e3ef55864abeef43d45fe0b3a1c2bc
Component: engine
2015-02-02 23:40:24 -08:00
56a2a654e8 Add an API test for docker build -f Dockerfile
I noticed that while we have tests to make sure that people don't
specify a Dockerfile (via -f) that's outside of the build context
when using the docker cli, we don't check on the server side to make
sure that API users have the same check done. This would be a security
risk.

While in there I had to add a new util func for the tests to allow us to
send content to the server that isn't json encoded - in this case a tarball

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 198ff76de59a600ce900497fd4a6131ee4448c48
Component: engine
2015-02-02 23:40:20 -08:00
c60988becd Merge pull request #10123 from duglin/Issue10097
Build CMD/ENTRYPOINT cache strings properly
Upstream-commit: 70fbd45a5c88f6f39a07b04f81a07721bf5f3eed
Component: engine
2015-01-28 14:43:16 -05:00
3c4927bcb2 Fix premature close of build output on pull
The build job will sometimes trigger a pull job when the base image
does not exist. Now that engine jobs properly close their output by default
the pull job would also close the build job's stdout in a cascading close
upon completion of the pull.

This patch corrects this by wrapping the `pull` job's stdout with a
nopCloseWriter which will not close the stdout of the `build` job.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: e662775ffb096fdb4a7f247bb25b8e3022006c1b
Component: engine
2015-01-27 10:07:01 -08:00
685b876322 Closes #9311 Handles container id/name collisions against daemon functionalities according to #8069
Signed-off-by: Andrew C. Bodine <acbodine@us.ibm.com>
Upstream-commit: d25a65375c880017ac0c516389b0b7afde810517
Component: engine
2015-01-21 17:11:31 -08:00
1a5071a250 Merge pull request #9826 from icecrime/8318_whitespace_add_copy
Support whitespace in paths for ADD and COPY
Upstream-commit: 50ff27caa13b4c558b0ddc9f65297b6ef6eb119d
Component: engine
2015-01-19 18:37:53 -05:00
6d8927db75 Build CMD/ENTRYPOINT cache strings properly
Make sure that as we build the CMD/ENTRYPOINT cache strings that we don't
treat ["echo","hi"] and ["echo hi"] as the same thing due to the fact that
we're just doing a strcat on the array.

Closes #10097

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 88905793add88c8d5ff93f0e9b1edca5f012da33
Component: engine
2015-01-15 12:49:30 -08:00
f71acef86e Merge pull request #9881 from tianon/json-array-of-strings
Adjust builder to validate that JSON in Dockerfiles are arrays of strings and nothing else to match how we describe them to people (and what all our existing tests already assumed)
Upstream-commit: 640e0fc578e5acdaa71216a300396dfa9af8054f
Component: engine
2015-01-14 17:13:51 -08:00
f2f058e60b builder: use len() > 0 instead of != nil
Signed-off-by: Tibor Vass <teabee89@gmail.com>
Upstream-commit: 3183af8b19d2adf29dd3fb80689d764353a3fe00
Component: engine
2015-01-14 16:55:56 -08:00
869bebb91c Fix a panic where RUN [] would be supplied.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 39343b86182b4e997dc991645729ae130bd0f5f2
Component: engine
2015-01-14 16:55:56 -08:00
59accfd690 Merge pull request #9973 from duglin/Issue9880
Make sure that ADD/COPY still populate the cache even if they don't use it
Upstream-commit: 99a15ec8bd548563a1ac4f652c55d4bb1ff769e4
Component: engine
2015-01-13 11:17:34 -08:00
3a63bcc0c5 Merge pull request #9980 from erikh/parser-with-no-command
Fix a parser error where an empty RUN statement would cause a panic
Upstream-commit: 32cde64c04acb0c227b9371028f68de1666bf503
Component: engine
2015-01-08 19:34:06 -05:00
5aa04a56fb 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>
Upstream-commit: 568f86eb186731b907b659e4ec64bda21c2fe31d
Component: engine
2015-01-08 20:14:58 +00:00
0e19110387 Fix a parser error where an empty RUN statement would cause a panic
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 09e3467452d24aca38810fa79a09d6371d2c0b5c
Component: engine
2015-01-08 11:30:08 -08:00
d2e16626e4 Make sure that ADD/COPY still populate the cache even if they don't use it
Closes #9880

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 6f20b957b09c0a7c81013088db7bcec6b3222613
Component: engine
2015-01-08 06:56:30 -08:00
269ee3bcdf Allow for Dockerfile to be named something else.
Add a check to make sure Dockerfile is in the build context
Add docs and a testcase
Make -f relative to current dir, not build context

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: eb3ea3b43c716ad727521a7d0bc20d7321bb0867
Component: engine
2015-01-06 16:33:26 -08:00
1a4a1b2193 Have .dockerignore support Dockerfile/.dockerignore
If .dockerignore mentions either then the client will send them to the
daemon but the daemon will erase them after the Dockerfile has been parsed
to simulate them never being sent in the first place.

an events test kept failing for me so I tried to fix that too

Closes #8330

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 6d801a3caa54ad7ef574bc426aa1ffc412c5af82
Component: engine
2015-01-06 10:57:48 -08:00
3bf489de75 Adjust builder to validate that JSON in Dockerfiles are arrays of strings and nothing else to match how we describe them to people (and what all our existing tests already assumed)
This also adds more tests to help verify this, including unicode and nonprintable characters (hence the earlier commit switching to strconv.Quote).

As a bonus, this fixes a subtle bug where [] was turned into [""] and then turned back into [] (and thus [""] was impossible to actually round-trip correctly in a Dockerfile).

Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
Upstream-commit: 05c2d2db9a95266217a639e2109be6fc6482a716
Component: engine
2015-01-05 14:31:05 -07:00
14afaafc58 Modify MAINTAINERS per erikh's suggestion
Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 04ee071692c320ac9dd8e66475c02c6ec3166251
Component: engine
2015-01-05 10:28:36 -08:00
74fe90f089 Simplify builder TestTestData slightly by using ioutil.ReadFile instead of os.Open+ioutil.ReadAll
Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
Upstream-commit: f6cb1ea85a7a75193644b8ba4516cb586c5dc52f
Component: engine
2015-01-02 22:38:52 -07:00
d0cdce5ce4 Simplify builder ast.Dump by using strconv.Quote instead of a custom QuoteString function (the only change to existing files is literal tabs becoming \t, but future files may use nonprintable characters and the like now)
Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
Upstream-commit: 1edf16e977a3dd18f9ff15b4acf40b0c1ac64788
Component: engine
2015-01-02 22:36:58 -07:00
7a2e194724 Add support file name with whitespace for ADD and COPY command
Closes #8318

Signed-off-by: Seongyeol Lim <seongyeol37@gmail.com>
Upstream-commit: abfb7138871993c53050a2d159ca0fae07bf65e8
Component: engine
2014-12-26 16:28:03 -08:00
98bb6eba72 Make FROM scratch a special cased 'no-base' spec
There has been a lot of discussion (issues 4242 and 5262) about making
`FROM scratch` either a special case or making `FROM` optional, implying
starting from an empty file system.

This patch makes the build command `FROM scratch` special cased from now on
and if used does not pull/set the the initial layer of the build to the ancient
image ID (511136ea..) but instead marks the build as having no base image. The
next command in the dockerfile will create an image with a parent image ID of "".
This means every image ever can now use one fewer layer!

This also makes the image name `scratch` a reserved name by the TagStore. You
will not be able to tag an image with this name from now on. If any users
currently have an image tagged as `scratch`, they will still be able to use that
image, but will not be able to tag a new image with that name.

Goodbye '511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158',
it was nice knowing you.

Fixes #4242

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 8936789919c5c8004f346f44a3452d1521818b60
Component: engine
2014-12-18 14:03:38 -08:00
a9b8d39261 Allow for relative paths on ADD/COPY
Moved Tianon's PR from: https://github.com/docker/docker/pull/7870
on top of the latest code

Closes: #3936

Signed-off-by: Andrew Page <admwiggin@gmail.com>
Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: f21f9f856e9d5af23521f131799028c2e67c04ed
Component: engine
2014-12-18 05:13:04 -08:00
2187cf5beb Merge pull request #9122 from dqminh/debug-huge-expose
Expose a large number of ports should not slow down builder
Upstream-commit: a76f7c6ec32431b6cbf286d9be86f7dde0b3ac0d
Component: engine
2014-12-16 10:03:31 -08:00
c0c6361cf0 builder: internals: fix incomplete chown walk when fixing permissions
This patch fixes the permission fixing code used by addContext, which
would not be responsible for Lchown-ing top-level directories added to a
destination that didn't exist prior to untar-ing the context.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> (github: cyphar)
Upstream-commit: 916cba9c587a3f3ce97b407993fecd96ac2fecaf
Component: engine
2014-12-12 06:07:16 +11:00
5231d38261 Fix permissions on ADD/COPY
Fix a regression introduced in PR#9467 when a single file was added or
copied.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: cfc24769a26e825e4267cbfdd59af807e27508b9
Component: engine
2014-12-10 11:09:03 -08:00
3ecd658560 Use Set for stderr "logs" job in builder
Because engine implicitly adds his stder to job stderr

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: a62cbdeb47e5e504e670c546ad8bec45e696f370
Component: engine
2014-12-09 19:08:24 -08:00
15957abc33 Reduce permissions changes scope after ADD/COPY
Permissions after an ADD or COPY build instructions are now restricted
to the scope of files potentially modified by the operation rather than
the entire impacted tree.

Fixes #9401.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: f3cedce3608afe7bd570666a7fc878ab85c7bc03
Component: engine
2014-12-04 17:16:22 -08:00
ed716fd8a8 Merge pull request #9323 from unclejack/merge_release_v1.3.2
Merge release v1.3.2 to master
Upstream-commit: e6ec703df31f04c3ea3a6aeb19881494a6ae58ae
Component: engine
2014-11-24 19:26:36 -05:00
033a9598e5 Update code for use of urlutil pkg
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 5794b5373ef26846b3cc5e48e651208771d12b19
Component: engine
2014-11-24 18:47:42 -05:00
9d0c84c559 pkg/chrootarchive: pass TarOptions via CLI arg
Signed-off-by: Tibor Vass <teabee89@gmail.com>

Conflicts:
	graph/load.go
		fixed conflict in imports
Upstream-commit: 9c01bc249dc628280f3fc019d5f0e0ace71be248
Component: engine
2014-11-25 01:03:40 +02:00
dd4a9e5429 add pkg/chrootarchive and use it on the daemon
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)

Conflicts:
	builder/internals.go
	daemon/graphdriver/aufs/aufs.go
	daemon/volumes.go
		fixed conflicts in imports
Upstream-commit: 1cb17f03d0b217acf2d2c289b4946d367f9d3e80
Component: engine
2014-11-25 01:03:40 +02:00
19f9fcbc25 build: add pull flag to force image pulling
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
Upstream-commit: 054e57a622e6a065c343806e7334920d17a03c5b
Component: engine
2014-11-21 19:59:44 +02:00
5dafd01fe8 Add support for ENV of the form: ENV name=value ...
still supports the old form: ENV name value

Also, fixed an issue with the parser where it would ignore lines
at the end of the Dockerfile that ended with \

Closes #2333

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 1314e1586f8cd6201c16161eb960a743c727946b
Component: engine
2014-11-20 09:54:28 -08:00
deefafa9d6 Remove unused sysinfo parameter to runconfig.Parse
Removing dead code.

Signed-off-by: John Gossman <johngos@microsoft.com>
Upstream-commit: e45b0f92711ff190cff4b61b2ea80cdd53203a16
Component: engine
2014-11-14 18:20:54 -08:00
69df5cc039 Updated cover tool import path.
Signed-off-by: Hans Rødtang <hansrodtang@gmail.com>
Upstream-commit: b4336803f35591c8e4d94b023c9d5e9525795520
Component: engine
2014-11-14 06:16:41 +01:00
159f1734a9 expose sorts its ports before saving as comment
Saving ports as `map[nat.Port]struct{}` directly has ordering issue which is
more replicatable where we expose a huge number of ports at the same time. As a
result, the cache will be burst whenever the map order is different from the
previous build.
This sorts the ports first and save them as a whitespace-separated list instead
of the map representation, so the order will always be consistent if the port
list isnt changed.

NOTICE: this will burst the old expose caches

Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)
Upstream-commit: 87d0562c61b80aba05f4c3b4f49f5527afb55989
Component: engine
2014-11-12 09:14:35 -05:00
9ca9222a81 speed up creation of args and msg for huge cmds
Whenever a command arguments is formed by a large linked list, repeatedly
appending to arguments and displayed messages took a long time because go will
have to allocate/copy a lot of times.

This speeds up the allocation by preallocate arrays of correct size for args
and msg

Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)
Upstream-commit: 3aae63f4528ab1d7e1e12cc4e2e7bacd97991d43
Component: engine
2014-11-12 00:04:45 -05:00