Commit Graph

493 Commits

Author SHA1 Message Date
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
17447fd1b0 correct some nits in comment and test files
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 52637848a769b8c80d2f1e28d3d34ada6d35b5a6
Component: engine
2016-08-29 18:37:14 +08:00
cf918862de fmt dockerfile error message
Signed-off-by: sakeven <jc5930@sina.cn>
Upstream-commit: 7d75e42bc9d0f19f8829b65634495965f02e89a3
Component: engine
2016-08-26 18:36:30 +08:00
db8cc1fdde Merge pull request #24978 from yongtang/24912-build-with-progress
Add hint of progress to the output of `docker build`
Upstream-commit: 282b0aff08030a2521adf7d64bdd333f0864b720
Component: engine
2016-08-18 16:10:48 -04:00
b496a6d286 Merge pull request #24311 from ShevYan/incorrect-comments-in-dockerfile
Dockerfile's comments for "Run the test suite" are out of date becaus…
Upstream-commit: 2faeebc7504acd257200ce26470d3037448ae952
Component: engine
2016-08-12 15:53:06 -07:00
cb1c855c27 Merge pull request #23951 from allencloud/defer-os-file-close
add defer file.Close to avoid potential fd leak
Upstream-commit: 64605d709f9bf5677d513d6ed78d63fffadc697d
Component: engine
2016-08-10 11:07:15 -07:00
1c502571ef add defer file.Close to avoid potential fd leak
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 0ead624473b6bddc232b46bc7c76ab4f9c743ff5
Component: engine
2016-08-10 08:36:09 +08:00
15fecb0bf3 More helpful error message when not sufficiently argumentative
The error message suggests you need one argument even when you
have provided one. Suggest having another argument.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
Upstream-commit: 4ce93940b7c2a640c94296f20352cf6f052d1028
Component: engine
2016-08-08 17:22:09 +01:00
bb00cee2aa Don't allow empty env names
Closes: #25281

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: e72c0137af63c2f5aecce48443e3b654a3895150
Component: engine
2016-08-01 10:25:51 -07:00
1c72cebc59 Merge pull request #23969 from tkopczynski/20784-builder-dockerfile-dispatchers-2
Builder dispatchers unit tests
Upstream-commit: 0fc062d31ea00286c49d2310e245b6bb7b4a16e1
Component: engine
2016-07-29 07:26:48 +02:00
16a63d94bb Move directive out of globals
Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 755be795b4e48b3eadcdf1427bf9731b0e97bed1
Component: engine
2016-07-26 10:35:33 -07:00
f4ad386d76 Fix issue with test ordering for TestParseWords
`TestParseWords` needs to use the `tokenEscape` for one of the test
cases, but `tokenEscape` was not being set unless tests ran in a
specific order.
This sets a default value for `tokenEscape`... `\`... so that tests that
rely on this global are not affected by test ordering.

This is the simplest fix for these cases. Ideally the token should not
be set as a global but rather passed down, which is a much larger
change.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: df167d3ff04cdc90012c8ca39647662ad69e6715
Component: engine
2016-07-26 10:50:12 -04:00
48c6a8f86f Add hint of progress to the output of docker build
This fix tries to address the issue raised in 24912 where docker
build only consists of the current step without overall total steps.

This fix adds the overall total steps so that end user could follow
the progress of the docker build.

An additonal test has been added to cover the changes.

This fix fixes 24912.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 35418c145518c3f816ae5837beda7d853ce96dfc
Component: engine
2016-07-24 08:13:58 -07:00
e0f9de9c83 Builder dispatchers unit tests
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
Upstream-commit: 9408b205f5ac4779cbcc75f42de995668d373baa
Component: engine
2016-07-12 07:40:25 +02:00
f7a6ca3323 Merge pull request #22868 from Microsoft/jjh/dockerfilecmd
Windows: CMD not honouring arg escaping
Upstream-commit: 6167a9ab166ce1e6fd0ffa653b9476d33983f15b
Component: engine
2016-07-07 09:21:26 -07:00
e4dfc2d04c Validate hostname starting from 1.24 API.
In order to keep a little bit of "sanity" on the API side, validate
hostname only starting from v1.24 API version.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 6daf3d2a783fd042e870c8af8bbd19fc28989505
Component: engine
2016-07-06 09:13:59 +02:00
dc5e6798a1 Dockerfile's comments for "Run the test suite" are out of date because there is no 'test' in hack/make directory.
Signed-off-by: Shev Yan <yandong_8212@163.com>
Upstream-commit: 11280665b45d0ac9920d17abaf6a7328f2bc77d9
Component: engine
2016-07-04 22:43:53 +08:00
0bdbf282f3 Fix spelling in comments, strings and documentation
Signed-off-by: Otto Kekäläinen <otto@seravo.fi>
Upstream-commit: 644a7426cc31c338fedb6574d2b88d1cc2f43a08
Component: engine
2016-07-03 20:58:11 +03:00
9de77e3319 Fix Malformed history layer - missing Sprintf in append of shell in Builder run config
Signed-off-by: Dan Feldman <danf@jfrog.com>
Upstream-commit: 29b6a696604d5bc80d1722e3ba123558bce7c7c9
Component: engine
2016-06-28 11:09:39 +03:00
ec8d3f9fa9 Builder/dockerfile/dispatchers.go tests
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
Upstream-commit: 5ece81a72aea6797809303aa3b68871f6ae01f6e
Component: engine
2016-06-19 14:45:34 +02:00
610f859f67 Windows: CMD not honouring arg escaping
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: d05d0211bcf43d4519bfcbbc6029fafa122f86b7
Component: engine
2016-06-15 16:46:32 -07:00
02e6cd83ac Merge pull request #23322 from tkopczynski/20784-builder-dockerfile-symlink
Reimplement integration test for symlink Dockerfile as a unit test
Upstream-commit: e08aed59dfd1642ae04ac4eb1055a378d6a572c1
Component: engine
2016-06-15 10:52:49 +02:00
f0593ff496 Reimplement integration test for symlink Dockerfile as a unit test
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
Upstream-commit: 830584b011ebf75500f307efa5425cf63e89d713
Component: engine
2016-06-14 23:07:19 +02:00
dc116784a5 Merge pull request #23093 from tkopczynski/20784-builder-dockerfile-outside-context
Builder integration tests for Dockerfile outside context as a unit test
Upstream-commit: 7d988a7aa6ae20020f0f96c6e2a47377e3567a3d
Component: engine
2016-06-14 08:44:24 +02:00
394bb94714 Fixed spelling error in builder/dockerfile/parser/parser.go
Signed-off-by: Tiffany Jernigan <tiffany.f.j@gmail.com>
Upstream-commit: a07c57f656846ee0de67ac4f575fe5b76d482efb
Component: engine
2016-06-09 14:49:59 -07:00
1a51605407 Support unicode characters in parseWords
Signed-off-by: Jonathan Stoppani <jonathan.stoppani@divio.com>
Upstream-commit: 6284f04a6b3a9b8127dc166ff84b102c8ad411ce
Component: engine
2016-06-08 14:05:08 +02:00
86b04a6a8a Merge pull request #22489 from Microsoft/jjh/shell
Builder shell configuration
Upstream-commit: df1dd1322d5c9527be7187038ca3480404b1282b
Component: engine
2016-06-05 17:43:12 +02:00
1a8439b6fb Reimplementing builder tests for Dockerfile outside context as a unit test
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
Upstream-commit: fb175bb36793ad59f2cfe9b2d92d636027fb836b
Component: engine
2016-06-05 08:39:06 +02:00
f88056a4aa Merge pull request #23232 from thaJeztah/update-default-retries
Healthcheck: set default retries to 3
Upstream-commit: 3db23a4eaf19d347c486f0f0ae764ea1b84491c0
Component: engine
2016-06-04 07:50:04 +02:00
d5ece41dcd Builder default shell
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: b18ae8c9ccc2eb6cf8aa947f25eb6f1d20089776
Component: engine
2016-06-03 13:54:31 -07:00
ab25cb22b0 Skip UTF-8 BOM bytes from Dockerignore if exist
This fix tries to address issues related to #23221 where Dockerignore
may consists of UTF-8 BOM. This likely happens when Notepad
tries to save a file as UTF-8 in Windows.

This fix skips the UTF-8 BOM bytes from the beginning of the
Dockerignore if exists.

Additional tests has been added to cover the changes in this fix.

This fix is related to #23221 (UTF-8 BOM in Dockerfile).

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: ea86320fcc61ea9ded3eef7ba01699c4e3ccf3ce
Component: engine
2016-06-03 07:26:36 -07:00
2c68691b95 Skip UTF-8 BOM bytes from Dockerfile if exists
This fix tries to address issues in #23221 where Dockerfile
may consists of UTF-8 BOM. This likely happens when Notepad
tries to save a file as UTF-8 in Windows.

This fix skips the UTF-8 BOM bytes from the beginning of the
Dockerfile if exists.

Additional tests has been added to cover the changes in this
fix.

This fix fixes #23221.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 678c80f9256021ce74184fdd6b612d9dea377fba
Component: engine
2016-06-03 06:16:50 -07:00
52ca58bbaa Healthcheck: set default retries to 3
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 50e470fab4ebdffff74bafeefa2f7fb8c21da13e
Component: engine
2016-06-03 13:28:08 +02:00
3dff30ced8 Add support for comment in .dockerignore
This fix tries to address the issue raised in #20083 where
comment is not supported in `.dockerignore`.

This fix updated the processing of `.dockerignore` so that any
lines starting with `#` are ignored, which is similiar to the
behavior of `.gitignore`.

Related documentation has been updated.

Additional tests have been added to cover the changes.

This fix fixes #20083.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 8913dace341c8fc9f9a3ab9518c8521c161b307f
Component: engine
2016-06-02 19:06:52 -07:00
4524589dc5 Add support for user-defined healthchecks
This PR adds support for user-defined health-check probes for Docker
containers. It adds a `HEALTHCHECK` instruction to the Dockerfile syntax plus
some corresponding "docker run" options. It can be used with a restart policy
to automatically restart a container if the check fails.

The `HEALTHCHECK` instruction has two forms:

* `HEALTHCHECK [OPTIONS] CMD command` (check container health by running a command inside the container)
* `HEALTHCHECK NONE` (disable any healthcheck inherited from the base image)

The `HEALTHCHECK` instruction tells Docker how to test a container to check that
it is still working. This can detect cases such as a web server that is stuck in
an infinite loop and unable to handle new connections, even though the server
process is still running.

When a container has a healthcheck specified, it has a _health status_ in
addition to its normal status. This status is initially `starting`. Whenever a
health check passes, it becomes `healthy` (whatever state it was previously in).
After a certain number of consecutive failures, it becomes `unhealthy`.

The options that can appear before `CMD` are:

* `--interval=DURATION` (default: `30s`)
* `--timeout=DURATION` (default: `30s`)
* `--retries=N` (default: `1`)

The health check will first run **interval** seconds after the container is
started, and then again **interval** seconds after each previous check completes.

If a single run of the check takes longer than **timeout** seconds then the check
is considered to have failed.

It takes **retries** consecutive failures of the health check for the container
to be considered `unhealthy`.

There can only be one `HEALTHCHECK` instruction in a Dockerfile. If you list
more than one then only the last `HEALTHCHECK` will take effect.

The command after the `CMD` keyword can be either a shell command (e.g. `HEALTHCHECK
CMD /bin/check-running`) or an _exec_ array (as with other Dockerfile commands;
see e.g. `ENTRYPOINT` for details).

The command's exit status indicates the health status of the container.
The possible values are:

- 0: success - the container is healthy and ready for use
- 1: unhealthy - the container is not working correctly
- 2: starting - the container is not ready for use yet, but is working correctly

If the probe returns 2 ("starting") when the container has already moved out of the
"starting" state then it is treated as "unhealthy" instead.

For example, to check every five minutes or so that a web-server is able to
serve the site's main page within three seconds:

    HEALTHCHECK --interval=5m --timeout=3s \
      CMD curl -f http://localhost/ || exit 1

To help debug failing probes, any output text (UTF-8 encoded) that the command writes
on stdout or stderr will be stored in the health status and can be queried with
`docker inspect`. Such output should be kept short (only the first 4096 bytes
are stored currently).

When the health status of a container changes, a `health_status` event is
generated with the new status. The health status is also displayed in the
`docker ps` output.

Signed-off-by: Thomas Leonard <thomas.leonard@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: b6c7becbfe1d76b1250f6d8e991e645e13808a9c
Component: engine
2016-06-02 23:58:34 +02:00
e9a370108d Fix directory walker error checking
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 81d24e754d48ac8e9f0e4fe02befbf628179da43
Component: engine
2016-05-26 14:59:38 -07:00
5bcb28804b Merge pull request #22268 from Microsoft/jjh/continuationescape
Support platform semantic file paths through ESCAPE
Upstream-commit: 8e924153e219d040e3aa672df4e0c7baff9f8d8b
Component: engine
2016-05-26 10:00:56 -07:00
dd19106ac3 Typo fix wiildcard -> wildcard
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
Upstream-commit: 86d48aa111384539b0d2bd50353c4d4c40a5750a
Component: engine
2016-05-22 18:39:35 +01:00
4197623885 Reimplementing more builder integration tests as unit tests
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
Upstream-commit: cf2611f3239d18919e437e82554cec178028612e
Component: engine
2016-05-22 01:00:57 +02:00
886f3ce26b Support platform file paths through escape
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: e8e3dd32c5bad727010ec787f484b98942977531
Component: engine
2016-05-20 20:29:59 -07:00
084ac6917b builder: fixed workdir comment
Signed-off-by: Wendel Fleming <wfleming@usc.edu>
Upstream-commit: 131161bbc7a153eac0eccf02fcfb0fc2f5d368b5
Component: engine
2016-05-19 15:40:46 -05:00