Commit Graph

533 Commits

Author SHA1 Message Date
4ee6d62486 Clean up tmp files for interrupted docker build
This fix tries to fix the issue raised in 29486 where interrupted
`docker build` leaves some tmp files in `/var/lib/docker/tmp`.
With tmp file name prefixed with `/var/lib/docker/tmp/docker-builderXXXXXX`.

The reason for the issue is that in `MakeTarSumContext()`:
```
	if err := chrootarchive.Untar(sum, root, nil); err != nil {
		return nil, err
	}
```
the `err` is shadowed and caused the clean up function in `defer func()`
not being called.

This fix fixes the issue.

This fix is tested manually, as was specified in 29486:
```
rm -rf /var/lib/docker/tmp

mkdir repro && cd repro
fallocate -l 300M bigfile

cat > Dockerfile <<EOF
FROM scratch
COPY ./bigfile /
EOF

docker build .
{Cancel}

ls -la /var/lib/docker/tmp
```

This fix fixes 29486.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 847564fa49b27af508a02a371583019482534d31
Component: engine
2016-12-16 21:11:53 -08:00
03e1686ef2 fix some wrong vars or funcs in builder.go
Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
Upstream-commit: ee8a3eee4fac23fcba9f9b95c5c627419f0b230d
Component: engine
2016-12-12 17:11:41 +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
443598f3ee Merge pull request #28972 from Microsoft/jjh/commentcorrection
Fix incorrect comment
Upstream-commit: 3676bad0411fafa823165d4510b8091198528288
Component: engine
2016-11-30 08:34:15 -05: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
6372d2470f Fix incorrect comment
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: b83076bfc076e1c00df40fadda60e1196b786921
Component: engine
2016-11-29 20:05:47 -08: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
7c8e31f530 fix using wrong function name for MakeTarSumContext
Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
Upstream-commit: 71f144648af71d8daa6481464707b4f8a9476a3c
Component: engine
2016-11-08 17:16:13 +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
913e9a48c1 Generate container create response from swagger spec.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: bad849fc826b410c3aeb753a8c7f6b38f7ae12b0
Component: engine
2016-10-31 11:16:02 -04: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
0d12f299cb Add a comment about how we don't mkdir during WORKDIR directly
Just to help the next time someone goes looking for it while debugging.
Like @jhowardmsft and I did while looking at #27545.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 9f79043a63302258a597a69b0c5ec5e09a480ac0
Component: engine
2016-10-28 19:24:37 -07:00
d280390d0c Merge pull request #24725 from yongtang/24693-dockerfile-empty-line-after-escape
Fix dockerfile parser with empty line after escape
Upstream-commit: c5adc271b2991c1eb8a25cdab14e425edb2cd99b
Component: engine
2016-10-28 13:53:15 -07:00
0e3402d520 Allow providing a custom storage directory for docker checkpoints
Signed-off-by: boucher <rboucher@gmail.com>
Upstream-commit: bd7d51292c399edba5f339e6be55fac6c0811ff5
Component: engine
2016-10-28 07:56:05 -04:00
5c99e2a951 Merge pull request #27805 from Microsoft/jjh/fixbuildercache
Windows: Fix builder cache bug
Upstream-commit: 9e206b551288c5197a2523ad0f887341972d75c8
Component: engine
2016-10-28 02:49:40 +02:00
6ef00270be Windows: Fix builder cache bug
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 4f3889e4be9fe518e9be73306a8716c3a5f4b1c6
Component: engine
2016-10-27 12:27:30 -07:00
bad2fec338 Fix dockerfile parser with empty line after escape
This fix tries to fix the bug reported by #24693 where an empty
line after escape will not be stopped by the parser.

This fix addresses this issue by stop the parser from continue
with an empty line after escape.

An additional integration test has been added.

This fix fixes #24693.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 3e1b539e8d0ed4abf695b0a8c42346fba6d5a6b0
Component: engine
2016-10-27 10:43:08 -07:00
b63aa05761 Merge pull request #27702 from tonistiigi/net-builder0
add --network option for docker build
Upstream-commit: 62ff3e90835c3c572051afbbbac53303e57a5c89
Component: engine
2016-10-25 21:50:33 -07:00
29210e7b5b add --network option for docker build
Signed-off-by: sandyskies <chenmingjie0828@163.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 60813af7aeea819ca228b6b1d6f4888969b95da3
Component: engine
2016-10-25 10:25:36 -07:00
adbaf3869a Windows: Honour escape directive fully
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 912781841422363219e064a1df6df39dabf4cd81
Component: engine
2016-10-21 14:22:14 -07:00
fe1dce6a91 pkg/archive: remove unnecessary Archive and Reader type
The `archive` package defines aliases for `io.ReadCloser` and
`io.Reader`. These don't seem to provide an benefit other than type
decoration. Per this change, several unnecessary type cases were
removed.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
Upstream-commit: aa2cc18745cbe0231c33782f0fa764f657e3fb88
Component: engine
2016-10-20 19:31:24 -07:00
21157ba472 Merge pull request #27436 from YuPengZTE/devFirst
The first letter should be small in error of remote.go
Upstream-commit: 462cb3855dcb3bf14214c23a9271ceb63b97ea67
Component: engine
2016-10-18 12:49:04 -07:00
5a9599d246 The first letter should be small in error of remote.go
Signed-off-by: YuPengZTE <yu.peng36@zte.com.cn>
Upstream-commit: 1d238181d9d7d3981ec5bdfd5236a701586cc8a9
Component: engine
2016-10-17 15:19:10 +08:00
086cdbe518 Merge pull request #27174 from duglin/Issue26027
Don't env-var evaluate labels from docker build cmd line
Upstream-commit: 6f54d70a54d8d711e2b9d1e2578d45682e7130b8
Component: engine
2016-10-14 20:57:41 -07:00
c39b9d6194 Remove checkpoint methods from builder backend
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 5fb3b4205a8b0635ff193791ef581939806eb8da
Component: engine
2016-10-11 14:00:29 -07:00
a92d57e7db Merge pull request #26719 from AkihiroSuda/fix-race-builder-vs-container-1
Fix a race found in TestBuildCancellationKillsSleep
Upstream-commit: f5f0b77cec3d05f9f9f3ec618693030166fb1aa0
Component: engine
2016-10-10 18:54:55 +02:00
75a301f015 Windows: Support credential specs
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: e85867cb68cc28208c91bb43fc5cdcff824c468e
Component: engine
2016-10-06 09:32:22 -07:00
0f8abc83e4 Don't env-var evaluate labels from docker build cmd line
Fixes #26027

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 28a9a7deb002f3c86cb59dbd02ee75435e7fe1e2
Component: engine
2016-10-05 18:17:02 -07:00
5bbd3d9214 Require continuation char to be last char in a line
While look at #27039 I noticed that we allow for whitespace after
the continuation char (\\) which is wrong. It needs to be the very
last char in the line.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 105bc63295a7126798d3722a0e205c5ead4e2b1c
Component: engine
2016-10-04 09:38:00 -07:00
45ef4c7643 Fix a race found in TestBuildCancellationKillsSleep
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Upstream-commit: ed2e79fc03cc78345675d208b3ace2c2fa688cb7
Component: engine
2016-09-27 16:19:49 +00:00
cc3c0d322a Implement build cache based on history array
Based on work by KJ Tsanaktsidis

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: KJ Tsanaktsidis <kjtsanaktsidis@gmail.com>
Upstream-commit: 690882c2e79c3f3742c709cf158584e61594ba00
Component: engine
2016-09-23 11:30:06 -07:00
a0b2adc110 Merge pull request #26516 from yongtang/26453-build-bad-syntax
Check bad syntax on dockerfile before building.
Upstream-commit: 72f556a9ff1043a4188e8eeef892d8a0ba4fe34f
Component: engine
2016-09-23 12:24:20 +02:00
92f94b6c20 correct some nits in comments
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 9279a93f6d43da4c904eeb0adb249fdfa34f7f92
Component: engine
2016-09-15 12:17:58 +08:00
efe814ccf6 Windows: Fix wildcard expansion after slash in filename
Signed-off-by: Darren Stahl <darst@microsoft.com>
Upstream-commit: 309056648c8263aca388e679179464e59a9f52c8
Component: engine
2016-09-14 11:40:57 -07:00
9a730a715e Check bad syntax on dockerfile before building.
This fix tries to address the issue raised in 26453 where bad syntax
on dockerfile is not checked before building, thus user has to wait
before seeing error in dockerfile.

This fix fixes the issue by evaluating all the instructions and check
syntax before dockerfile is invoked actually.

All existing tests pass.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: c8dc2b156a079ce03db8f579094b9643632661a8
Component: engine
2016-09-13 21:43:10 -07:00
7bef93723c Initial implementation of containerd Checkpoint API.
Signed-off-by: boucher <rboucher@gmail.com>
Upstream-commit: d8fef66b03c1ea8715470690efbd950033f7f628
Component: engine
2016-09-08 21:31:52 -04:00
45ddc4bfcb Add engine-api types to docker
This moves the types for the `engine-api` repo to the existing types
package.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 91e197d614547f0202e6ae9b8a24d88ee131d950
Component: engine
2016-09-07 11:05:58 -07:00
637e45cd56 Merge pull request #26290 from tonistiigi/govet17
Fix govet for go1.7
Upstream-commit: c73fae2352788323476759f4199b034b7ffc54dd
Component: engine
2016-09-03 19:27:19 +02:00
833a33ebb8 Fix govet for go1.7
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 7a8c7b47cffa8485b03db715f78c087b01ae5dfa
Component: engine
2016-09-02 19:07:54 -07:00
22f7fc770f Fix exec form of HEALTHCHECK CMD
We attached the JSON flag to the wrong AST node, causing Docker to treat
the exec form ["binary", "arg"] as if the shell form "binary arg" had
been used. This failed if "ls" was not present.

Added a test to detect this.

Fixes #26174

Signed-off-by: Thomas Leonard <thomas.leonard@docker.com>
Upstream-commit: e95b6b51daed868094c7b66113381d5088e831b4
Component: engine
2016-08-31 17:50:12 +01:00