Commit Graph

59 Commits

Author SHA1 Message Date
ded3de600a 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>
Upstream-commit: 54240f8da9992880e20a1508e9a6f0e59f2adef1
Component: engine
2015-09-16 03:31:15 -07:00
1e38e54eff 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>
Upstream-commit: 3781cde61ff10b1d9114ae5b4c5c1d1b2c20a1ee
Component: engine
2015-09-10 19:56:05 -04:00
a9c24d4837 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>
Upstream-commit: d45fcc6c80bd67ee6a06821fd64cad029d3a756f
Component: engine
2015-08-19 11:11:46 +09:00
8728d5d064 builder: avoid decoding "null" string in ADD, COPY and VOLUME step to nil slice
Signed-off-by: Soshi Katsuta <katsuta_soshi@cyberagent.co.jp>
Upstream-commit: 2d6952e8a52168f7204fc6834e6f5d28a5b21a37
Component: engine
2015-08-18 21:15:57 +09:00
2c6e673ce7 typofix - https://github.com/vlajos/misspell_fixer
Signed-off-by: Veres Lajos <vlajos@gmail.com>
Upstream-commit: 514623272398574c8fd7ef3fe42c5b2ae161349a
Component: engine
2015-08-07 23:25:49 +01:00
43c8d7a97f Fix golint warnings for builder
Addresses: #14756

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: 8c4a282a5719455cb5c63b917deb2a2042eed685
Component: engine
2015-07-22 13:29:03 +08:00
57eb64c9c0 Carry of PR #13520
Removinig files

Signed-off-by: Mary Anthony <mary@docker.com>
Upstream-commit: cd44018856be421497a35d96f88dd0eec42fae43
Component: engine
2015-06-13 09:27:30 -07:00
d7923211b9 Remove unused Dockerfile instruction INSERT
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: 596e91638cbe8b583dff4fdfc5a52e9d3840b20f
Component: engine
2015-05-06 16:26:43 -07:00
d887efe03f Add support for Dockerfile CMD options
This adds support for Dockerfile commands to have options - e.g:
   COPY --user=john foo /tmp/
   COPY --ignore-mtime foo /tmp/

Supports both booleans and strings.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: a8e871b0bbbb63310f372332176875ffcc01aaf6
Component: engine
2015-04-28 05:28:46 -07:00
e5f7f8da6f Replace json.Unmarshal with json.Decoder().Decode()
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: 26543e03095eaa45d9afc12c029f07539323fee5
Component: engine
2015-04-26 15:02:01 +02:00
b7982a6499 Fix a typo in comment of parseMaybeJSONToList
Signed-off-by: Yu Changchun <yuchangchun1@huawei.com>
Upstream-commit: 24dd8a4698315a4aafee5071f4fe4d74fa06c377
Component: engine
2015-04-11 10:34:21 +08:00
0221549820 Cleanup redundant else statements find via golint #11602
Signed-off-by: George MacRorie <gmacr31@gmail.com>
Upstream-commit: 664ef0cbe2113e8307135e656cc6db9199f8268e
Component: engine
2015-03-23 20:40:29 +00:00
490a18c994 Fix some escaping around env var processing
Clarify in the docs that ENV is not recursive

Closes #10391

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 6d66e3e7a5ecb021a9e89c4f85fadecf23e2000c
Component: engine
2015-03-20 20:09:00 -07:00
ad61919ab6 Some fixed for new LABEL stuff
- command.Commands was missing "Label"
- used the correct error string in dispatcher when LABEL has no args, otherwise
  the test TestBuildMissingArgs will not work
- removed the premature error msg in line_parser that was blocking the
  label() func in dispatcher from showing the err msg in previous bullet
- since LABEL uses the env parser it needs to be added to the replaceEnvAllowed
  list so that proper quote processing will be done.  Especially once
  PR #10431 is merged.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 6784a772baaa20936f00b8adc00a4b4444356181
Component: engine
2015-03-16 22:53:41 -07:00
5f00f97ea0 Merge pull request #9882 from ibuildthecloud/labels
Proposal: One Meta Data to Rule Them All => Labels
Upstream-commit: b6ac111abfbed628a80b67f0b092a248083b354c
Component: engine
2015-03-16 20:20:05 -07:00
c29e43cc4b Format error by value
- Use `%v` verb to format errors.
- Give `param` constant in portallocator some better name.

Signed-off-by: Michal Minar <miminar@redhat.com>
Upstream-commit: 210ab030bc3dab7bcf8f7252f2f9facb5a26cb6b
Component: engine
2015-03-16 12:05:53 +01:00
51b13a7774 Allow specification of Label Name/Value pairs in image json content
Save "LABEL" field in Dockerfile into image content.

This will allow a user to save user data into an image, which
can later be retrieved using:

docker inspect IMAGEID

I have copied this from the "Comment" handling in docker images.

We want to be able to add Name/Value data to an image to describe the image,
and then be able to use other tools to look at this data, to be able to do
security checks based on this data.

We are thinking about adding version names,
Perhaps listing the content of the dockerfile.
Descriptions of where the code came from etc.

This LABEL field should also be allowed to be specified in the
docker import --change LABEL:Name=Value
docker commit --change LABEL:Name=Value

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
Upstream-commit: cdfdfbfb6223fdd5b319942d412caac6bc09cdeb
Component: engine
2015-03-13 09:47:09 -07:00
8e64a493c0 cleanup: simplify parser_test
parser_test only needed the directory-names for
the tests to run. This replaces f.Readdir() with
f.Readdirnames() to only return the names.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 9e63b0d0f9530a0a7d6445606062b8ca99793792
Component: engine
2015-03-10 00:55:00 +01:00
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
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
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
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
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
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
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
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
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
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
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
7a77c7a4b5 Remove the redundant stripComment.
Signed-off-by: xuzhaokui <cynicholas@gmail.com>
Upstream-commit: 6c79ee7d1e38f7b2f408105db9af7fcf9942f7ca
Component: engine
2014-11-09 23:07:44 +08:00
dc1bcb95a0 builder: some small fixups + fix a bug where empty entrypoints would not override inheritance.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: cdd6e97910c50e5766c8bec2121f906e9ee2d119
Component: engine
2014-10-24 00:23:25 +00:00
c1f75e87da DOCKER_VERSION and docker-version havn't been implemented.
So far, it looks like the declarations are not used, and so its safer not to
confuse people into thinking they do something.

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@docker.com> (github: SvenDowideit)
Upstream-commit: 6ed610fb8014d500e001bb0677f0e1af0dc9312d
Component: engine
2014-10-21 16:04:11 +10:00
d86ec1998c Merge pull request #8578 from erikh/fix_slash
builder: Handle trailing \ appropriately.
Upstream-commit: 9a827137725d13dbe14c577df40dc35d061152b3
Component: engine
2014-10-15 12:11:37 -07:00
33fccf1f63 Merge pull request #8579 from erikh/builder_html_panic
builder: handle anything we cannot parse the command for as a fatal error
Upstream-commit: abec82bdeee84cef603561ae29fed45e45130a7c
Component: engine
2014-10-15 12:01:52 -07:00
7e0088079e builder: provide a friendly message on parser errors
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 3f2eb353bdbb36ce26690909bcf761d4289294d6
Component: engine
2014-10-15 18:08:23 +00:00
4a6aadc8cd builder: handle anything we cannot parse the command for as a fatal error.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 63637b9d277d322a06f24e3195fab48bc2a705d6
Component: engine
2014-10-15 08:47:15 +00:00
ac6df7dc24 builder: comments should also be elided in the middle of statements following a line continuation.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 96f342f7030c3955900f8f2ddf06b0d36b1d993c
Component: engine
2014-10-15 08:44:14 +00:00
8a73cf85f8 builder: strip blank lines before processing any line continuations.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: a1ef2207dd1f63a4104cfbf7927931174f5438a5
Component: engine
2014-10-15 04:00:17 +00:00
61f914763d builder: Handle trailing \ appropriately.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 7fa449191ce9abc3e0a5261b66d8338948f66940
Component: engine
2014-10-15 03:08:18 +00:00
3381602232 builder: ONBUILD triggers were not accurately being executed in JSON cases.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 1150c1639a9efbd2e5e4ac1e71961aef77a32de0
Component: engine
2014-10-14 01:59:45 +00:00
94f1cd5e88 ignore invalid Dockerfile instructions and do not consider "docker-version" a Dockerfile instruction
Signed-off-by: Tibor Vass <teabee89@gmail.com>
Upstream-commit: 0a2c481c7f24fcd295b1e1f6504732971b289919
Component: engine
2014-10-06 23:26:59 -04:00
009f167f3a Fix builder/parser so it keeps some whitespace on split lines.
If previous line ends with whitespace, or next line starts with whitepsace
we need to preserve a space otherwise things line:
RUN echo\
   hello
will appear as: RUN echohello

Noticed this while looking at #5744 because he had lines ending in &&\

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: f440c6b2246cc4cfac4c5d351172e209dca2c765
Component: engine
2014-10-03 20:33:12 -07:00
cdd6c2350b builder: Fix handling of VOLUME command where multiple volumes are
specified in a space delimited list.

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: a5ca549a18fb5c1006005cc220ab330eec3018de
Component: engine
2014-09-25 09:44:19 -07:00
35b33a60e1 builder/parser: fix handling of empty strings as the only argument.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 6b322ad2d32b1525ad01611f0d6ad8d803f5f6f0
Component: engine
2014-09-11 06:00:24 -07:00
c4ae3304f1 builder/parser/dumper: Handle newlines appropriately.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 234f0e4f79c27a4820f75a504fdcd45b2981a68a
Component: engine
2014-09-11 06:00:24 -07:00
3c324ec48a Fix panic when ENV ARG=ARG is used.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: a0255ba502d7a60a297aa67604eae75a9e1fbed3
Component: engine
2014-08-31 05:39:36 -07:00
4308bf42dd builder: several fixups from comments
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 305f73508022d0a3af65faa327aa798610969875
Component: engine
2014-08-27 18:52:30 -07:00