Commit Graph

208 Commits

Author SHA1 Message Date
c90ad1369f Merge pull request #31257 from tonistiigi/nested-build
build: add multi-stage build support
Upstream-commit: 2fa8fe400d926b3ceb0c84640a8f4e0f36e51463
Component: engine
2017-03-23 19:14:13 -07:00
e59b5a1439 Add support for COPY from previous rootfs
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: f95f58283b2a69f4fd06d01de2281641e09b06bb
Component: engine
2017-03-23 15:12:15 -07:00
cc2d5e2aaf Ignore built-in allowed build-args in image history
Removes the build-args from the image history if they are in the
BuiltinAllowedBuildArgs map unless they are explicitly defined in an ARG
instruction.

Signed-off-by: Dave Tucker <dt@docker.com>
Upstream-commit: 89a2a885c82bade2774f4b669b4e09ede8f840c3
Component: engine
2017-03-21 16:36:48 +00:00
00541f8de2 Fix cache for dockerfiles with multiple FROM
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: acad599210b5c00a4f3a8eae05de21d0d9ef8a88
Component: engine
2017-03-20 11:24:50 -07:00
fb83132fe7 Fix ARG scoping for Dockerfiles with multiple FROM
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 09f308ce211cd00f24d4e0f8cc797816b4fff1b6
Component: engine
2017-03-20 11:24:44 -07:00
a835f1babb fix misspell in utils.go
Signed-off-by: Helen Xie <chenjg@harmonycloud.cn>
Upstream-commit: 2b79dbc89bf15c276145a0fa3d3728308349f86e
Component: engine
2017-03-20 19:52:00 +08:00
63bea006b9 extract a function
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 9ea5e02e92d2d39e771d10eb0acf341ba9b58ceb
Component: engine
2017-03-08 11:46:09 -05:00
a09edbbf93 Merge pull request #31177 from allencloud/donot-allow-subsecond-in-dockerfile-healthcheck
do not allow sub second in healthcheck options in Dockerfile
Upstream-commit: fb1890fb9530b3f69b0d9f937fd0b6d8b1972311
Component: engine
2017-03-08 15:18:09 +01:00
12aa0347d6 Merge pull request #30383 from TDAbboud/30096-add-host-docker-build
Add --add-host for docker build
Upstream-commit: a64ea37753fd9a94dfa3ab81f67f46df7bd641f8
Component: engine
2017-02-27 12:42:18 +01:00
458406a7f3 Merge pull request #31212 from fate-grand-order/fixed
use t.Fatal() to output the err message and fix typo
Upstream-commit: a6576b8a2bff0feeb67918403caa3df0c4c37673
Component: engine
2017-02-27 12:26:35 +09:00
f19067fd22 Refactor to remove duplicate code around BuildArgs.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 6e005fd5ccd6ba90b51212c4a2539712b6398afd
Component: engine
2017-02-24 16:22:32 -05:00
9632b0f1e8 use t.Fatal() to output the err message where the values used for formatting
text does not appear to contain a placeholder

Signed-off-by: Helen Xie <chenjg@harmonycloud.cn>
Upstream-commit: 2a8d6368d4a930203b93f75914173ab65bf3b0bc
Component: engine
2017-02-23 10:16:22 +08:00
a8278abaf1 fix wrong print format
Signed-off-by: Reficul <xuzhenglun@gmail.com>
Upstream-commit: 9b1ceecd8a44e72ad773f7016df09a4b285258b8
Component: engine
2017-02-21 10:26:06 +08:00
7dba33b4e7 Add --add-host for docker build
Signed-off-by: Tony Abboud <tdabboud@hotmail.com>
Upstream-commit: 7a962e4577628c357f96153eca07e527813fb42b
Component: engine
2017-02-20 17:32:28 -05:00
de008a1137 do not allow sub second in healthcheck options in Dockerfile
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 63811a82b67528494f711086547580e7c40aaa93
Component: engine
2017-02-20 15:47:34 +08:00
29e3dcbbb0 why there are so many mistakes in our repo (up to /cmd)
Signed-off-by: Aaron.L.Xu <likexu@harmonycloud.cn>
Upstream-commit: f8a40477960976f12dbbb72e5b133b5b0f05f9b3
Component: engine
2017-02-17 00:32:48 +08:00
be4d0dc6ad Reset stdin config before running build actions
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 0f293f9eb31bdf8ff7adcb31baafca3f6fde3aab
Component: engine
2017-02-15 11:49:17 -08:00
c355cec53c Merge pull request #30457 from dmcgowan/distribution-reference-update-2
reference: use distribution reference and remove fork
Upstream-commit: 254fc83cba90ed79c78f4cb0cb33aeeaff492798
Component: engine
2017-02-07 22:01:25 +01:00
2260389fe6 Use distribution reference
Remove forked reference package. Use normalized named values
everywhere and familiar functions to convert back to familiar
strings for UX and storage compatibility.

Enforce that the source repository in the distribution metadata
is always a normalized string, ignore invalid values which are not.
Update distribution tests to use normalized values.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 3a1279393faf78632bf169619d407e584da84b66
Component: engine
2017-02-07 11:08:37 -08:00
1c2a160811 Ignore the daemon log config when building images.
Logs created by build containers should be handled by the daemon, not by logging drivers.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 80b642ff881d21ba6d006b8e52458335462d05b6
Component: engine
2017-01-30 10:59:19 -05:00
3c805f2872 Remove unnecessary if in parser.Dump
Signed-off-by: Anthony Sottile <asottile@umich.edu>
Upstream-commit: 2283cd020373ebd00e5cf37a81df451349c3b506
Component: engine
2017-01-28 23:07:24 -08:00
ae5b65a856 Merge pull request #30208 from justincormack/no-sqlite
Remove sqlite dependency
Upstream-commit: 0e8c7d72771847227df295471ac73180cbb3caa9
Component: engine
2017-01-18 13:15:38 -05:00
ecfeb35159 Remove sqlite
This drops support for migrations from pre-1.10 Docker versions, which
should be done via an external tool or an intermediate upgrade.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
Upstream-commit: f8119bb7a76b5c42defb6e0a2dc67bd77ad29a5e
Component: engine
2017-01-18 12:27:21 +00:00
287ee51be3 Refactoring ineffectual assignments
This patch fixed below 4 types of code line
1. Remove unnecessary variable assignment
2. Use variables declaration instead of explicit initial zero value
3. Change variable name to underbar when variable not used
4. Add erro check and return for ignored error

Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
Upstream-commit: 6306019d0bad9c4e60ee437e93f2450dfb0b68c0
Component: engine
2017-01-13 00:27:01 -07:00
2cf38188cb Merge pull request #30039 from ripcurld0/specify_line_no_dockerfile_err
Specify in which line the Dockerfile parser failed
Upstream-commit: 597843e79040a4f00bfe2abd83343d43edd195f5
Component: engine
2017-01-12 19:48:45 -05:00
a1c6880e0b Specify in which line the Dockerfile parser failed
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Upstream-commit: 8f282cdea5186896923da02f420e929c8ded61cb
Component: engine
2017-01-12 17:45:45 +02:00
cc35939485 Revert "Require continuation char to be last char in a line"
This reverts commit 105bc63295a7126798d3722a0e205c5ead4e2b1c,
which (although correct), resulted in a backward incompatible
change.

We can re-implement this in future, after this changes goes
through a deprecation cycle

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: c67550414b762ab32ea3e9645ebcafb79cb9059d
Component: engine
2017-01-10 00:41:03 +01:00
236f68013a Fix workdir cache invalidation
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: e16086005425b626bccc0fedcf5ae195f913c636
Component: engine
2017-01-06 12:10:59 -08:00
6b3d2b6135 Merge pull request #28631 from likel/master
Don't do format if it's unnecessary
Upstream-commit: d6be0e98027611cfb14a3246ca797bee0936e649
Component: engine
2016-12-30 01:13:12 +01:00
7b188d600d Merge pull request #29624 from yongtang/29619-build-label-order
Sort the labels passed from `build --labels`
Upstream-commit: aacc2c88803b4b908a4e565a1dd5f7fafa5e54f0
Component: engine
2016-12-29 15:09:53 -08:00
b4cbe892e8 Merge pull request #29679 from yongtang/29667-docker-build-workdir-cmd
Fix image's `CMD` after `WORKDIR` in Dockerfile
Upstream-commit: a2b12b5e82d50dad6c4a109501260f2307cf1d75
Component: engine
2016-12-28 20:26:59 -05:00
0cddfcad2f fix nits in comments
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 6fb05778ba241b344dd9014ff1091e3f70a8b40c
Component: engine
2016-12-27 23:30:50 +08:00
7c2700ecf9 Remove redundant format
Signed-off-by: Ke Li <kel@splunk.com>

Add missing changes

Signed-off-by: Ke Li <kel@splunk.com>

User errors.New to create error

Signed-off-by: Ke Li <kel@splunk.com>
Upstream-commit: 514adcf4580effa4820be8d5e6d2c0ea9825ceb2
Component: engine
2016-12-27 21:46:52 +08:00
4fcf2cd7b7 Fix image's CMD after WORKDIR in Dockerfile
This fix tries to fix 29667 where image's `CMD` is modified
after `WORKDIR` in Dockerfile.

The value of `b.runConfig.Cmd` was modified in the processing
of `WORKDIR`, in order to fix 28902. However, the same
`b.runConfig.Cmd` is passed to `commit()`.

This fix restored the `b.runConfig.Cmd` before `commit()`
the image for `WORKDIR`.

A test has been added.

This fix fixes 29667.

This fix is related to 28902, 28909, 28514.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 083602384737635af9a89b75a6ca6d27f7515dc6
Component: engine
2016-12-26 20:43:29 -08:00
69c28618c2 Sort the build labels passed from build --labels
This fix tries to fix the issue in 29619 where
labels passed from `build --labels` are not sorted.
As a result, if multiple labels have been passed,
each `docker build --labels A=A --labels B=B --labels C=C`
will generate different layers.

This fix fixes the issue by sort the Labels before
they are concatenated to `LABEL ...`.

A unit test has been added to cover the changes

This fix fixes 29619.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: d32efdbf8baba891a35c740454624206f41be94a
Component: engine
2016-12-22 07:32:52 -08:00
ce009b27d8 Fix processing of unset build-args during build
This reverts 26103.  26103 was trying to make it so that if someone did:
  docker build --build-arg FOO .
and FOO wasn't set as an env var then it would pick-up FOO from the
Dockerfile's ARG cmd.  However, it went too far and removed the ability
to specify a build arg w/o any value. Meaning it required the --build-arg
param to always be in the form "name=value", and not just "name".

This PR does the right fix - it allows just "name" and it'll grab the value
from the env vars if set. If "name" isn't set in the env then it still needs
to send "name" to the server so that a warning can be printed about an
unused --build-arg. And this is why buildArgs in the options is now a
*string instead of just a string - 'nil' == mentioned but no value.

Closes #29084

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: cdb8ea90b04683adb25c8ccd71b6eaedc44b51e2
Component: engine
2016-12-07 07:41:55 -08:00
c0aa09b760 Merge pull request #28988 from vdemeester/28985-dont-validate-hostname
Remove hostname validation as it seems to break users
Upstream-commit: 3cb310c21049f652dd00d20899cb1ece1ee9aa8f
Component: engine
2016-12-02 21:16:56 -05:00
e8c489744e Revert "Fix dockerfile parser with empty line after escape"
This reverts commit 3e1b539e8d0ed4abf695b0a8c42346fba6d5a6b0.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 6e0666e622a8b1fc19c19eb490d218eebca15edc
Component: engine
2016-12-02 14:15:55 +01:00
c46ac53d0a Remove hostname validation as it seems to break users
Validation is still done by swarmkit on the service side.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: ef39256dfb711f8382a5c021b85d6c7d613282b0
Component: engine
2016-11-30 19:22:07 +01:00
741407c1aa Merge pull request #28725 from Microsoft/jjh/builderenvcaseinsensitive
Windows: Builder case insensitive env
Upstream-commit: 4a0e295cd1702c36d883b0d2e52c039f407097a2
Component: engine
2016-11-30 08:33:29 -05:00
4c2dcd5ab3 WORKDIR set cmd
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 1b97bb416b8e2d4cd77544a1d714026b25d73c2f
Component: engine
2016-11-28 15:44:10 -08:00
f53ec9c3d1 Windows: Builder case insensitive env
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 49f392ff6b528d571eac538f5365bd51c4c83e5c
Component: engine
2016-11-28 10:30:45 -08:00
e12f9af05e COPY file . after WORKDIR (now always created)
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 286ab6d69bb999f5fcbdfdcac50bb8d65bb50c56
Component: engine
2016-11-23 09:56:02 -08:00
b8e423e3ed Windows: Allow user in builder
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: a3c4ab9b657018cf6fc33e70a44c790563c16043
Component: engine
2016-11-14 14:10:47 -08:00
d1279f3328 Fix case where \\ at EOF made the builder ignore the command
Came from looking at issue #27545

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: eaf0b5708fc91ab0c78eeee1a2c9c1251439d4a8
Component: engine
2016-11-03 05:48:49 -07:00
9e9fd11160 Merge pull request #22641 from cpuguy83/build_finalization
Adds ability to flatten image after build
Upstream-commit: 22f3e43e9a35711bb63108f1714840a92a4b138e
Component: engine
2016-11-01 14:30:18 -07:00
c7c95dc226 Adds ability to squash image after build
Allow built images to be squash to scratch.
Squashing does not destroy any images or layers, and preserves the
build cache.

Introduce a new CLI argument --squash to docker build
Introduce a new param to the build API endpoint `squash`

Once the build is complete, docker creates a new image loading the diffs
from each layer into a single new layer and references all the parent's
layers.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 362369b4bbea38881402d281ee2015d16e8b10ce
Component: engine
2016-11-01 13:41:59 -04:00
bedb3b19ee Convert Unused ARG error to warning
Signed-off-by: Addam Hardy <addam.hardy@gmail.com>
Upstream-commit: f150f42009dddb4f9b8d4ceef8763af701b0d0f9
Component: engine
2016-10-31 21:42:50 -05:00
7a6b35c7c0 Use filepath.Clean in normaliseWorkdir for windows
As is seem in the comment of `normaliseWorkdir` for windows:
```
...
	//	WORKDIR c:\\foo                 --> C:\foo
	//	WORKDIR \\foo                   --> C:\foo
...
```

However, this is not the case in the current implementation because
`filepath.FromSlash` is used and `FromSlash` does not replace multiple
separator with a single one (`file.Clean` does).
So `normaliseWorkdir` does not truly normalize workdir.

This fix changes the implementation of `normaliseWorkdir` and use
`filepath.Clean` instead of `filepath.FromSlash`.

Additional test cases have been added to the unit test.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 6f7e8d1d7fb94c89dc3d886dd131173d58aa10f0
Component: engine
2016-10-31 13:27:05 -07:00
34bac6f06e Fix bunch of typos
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: e6866492c4492db3bb9546afa2fbaed20f4c1883
Component: engine
2016-10-29 15:03:26 +08:00