Commit graph

466 commits

Author SHA1 Message Date
John Howard
cda10d4d7f Move directive out of globals
Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
(cherry picked from commit 755be795b4)
Signed-off-by: Tibor Vass <tibor@docker.com>
2016-07-27 14:51:42 -07:00
Brian Goff
d79bd3010a 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>
(cherry picked from commit df167d3ff0)
Signed-off-by: Tibor Vass <tibor@docker.com>
2016-07-27 14:51:42 -07:00
Vincent Demeester
6966df5de7 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>
(cherry picked from commit 6daf3d2a78)
Signed-off-by: Tibor Vass <tibor@docker.com>
2016-07-08 15:32:19 -07:00
Otto Kekäläinen
664c75ebba Fix spelling in comments, strings and documentation
Signed-off-by: Otto Kekäläinen <otto@seravo.fi>
(cherry picked from commit 644a7426cc)
Signed-off-by: Tibor Vass <tibor@docker.com>
2016-07-08 15:31:42 -07:00
danf
a55b4462d4 Fix Malformed history layer - missing Sprintf in append of shell in Builder run config
Signed-off-by: Dan Feldman <danf@jfrog.com>
(cherry picked from commit 29b6a69660)
2016-06-30 16:47:52 -07:00
Vincent Demeester
7d988a7aa6 Merge pull request #23093 from tkopczynski/20784-builder-dockerfile-outside-context
Builder integration tests for Dockerfile outside context as a unit test
2016-06-14 08:44:24 +02:00
Tiffany Jernigan
a07c57f656 Fixed spelling error in builder/dockerfile/parser/parser.go
Signed-off-by: Tiffany Jernigan <tiffany.f.j@gmail.com>
2016-06-09 14:49:59 -07:00
Jonathan Stoppani
6284f04a6b
Support unicode characters in parseWords
Signed-off-by: Jonathan Stoppani <jonathan.stoppani@divio.com>
2016-06-08 14:05:08 +02:00
Vincent Demeester
df1dd1322d Merge pull request #22489 from Microsoft/jjh/shell
Builder shell configuration
2016-06-05 17:43:12 +02:00
Tomasz Kopczynski
fb175bb367 Reimplementing builder tests for Dockerfile outside context as a unit test
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-06-05 08:39:06 +02:00
Vincent Demeester
3db23a4eaf Merge pull request #23232 from thaJeztah/update-default-retries
Healthcheck: set default retries to 3
2016-06-04 07:50:04 +02:00
John Howard
b18ae8c9cc Builder default shell
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-06-03 13:54:31 -07:00
Yong Tang
ea86320fcc 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>
2016-06-03 07:26:36 -07:00
Yong Tang
678c80f925 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>
2016-06-03 06:16:50 -07:00
Sebastiaan van Stijn
50e470fab4
Healthcheck: set default retries to 3
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-06-03 13:28:08 +02:00
Yong Tang
8913dace34 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>
2016-06-02 19:06:52 -07:00
Thomas Leonard
b6c7becbfe
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>
2016-06-02 23:58:34 +02:00
Tonis Tiigi
81d24e754d Fix directory walker error checking
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-05-26 14:59:38 -07:00
Arnaud Porterie
8e924153e2 Merge pull request #22268 from Microsoft/jjh/continuationescape
Support platform semantic file paths through ESCAPE
2016-05-26 10:00:56 -07:00
Alex Ellis
86d48aa111 Typo fix wiildcard -> wildcard
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2016-05-22 18:39:35 +01:00
Tomasz Kopczynski
cf2611f323 Reimplementing more builder integration tests as unit tests
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-05-22 01:00:57 +02:00
John Howard
e8e3dd32c5 Support platform file paths through escape
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-05-20 20:29:59 -07:00
Wendel Fleming
131161bbc7 builder: fixed workdir comment
Signed-off-by: Wendel Fleming <wfleming@usc.edu>
2016-05-19 15:40:46 -05:00
Sebastiaan van Stijn
9de21de453 Merge pull request #22462 from Microsoft/jjh/22181unittests
Windows: Reduce CLI time, move some to unit tests
2016-05-13 00:27:29 +02:00
Tomasz Kopczynski
18eeb39985 Reimplementing builder integration tests as unit tests
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-05-11 22:13:39 +02:00
Vincent Demeester
16d0a89593 Merge pull request #22485 from tkopczynski/test-utils
Builder unit tests refactoring
2016-05-06 22:05:02 +02:00
John Howard
faab71701f Windows: Reduce CLI time, move some to unit tests
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-05-06 12:26:08 -07:00
John Howard
6b5c83bf18 Windows: Support ARG in builder
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-05-04 14:32:23 -07:00
Tomasz Kopczynski
ab2baf08f0 Builder unit tests refactoring
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-05-03 19:00:35 +02:00
Tomasz Kopczynski
e00ad7227e Unit test for builder/remote.go
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-05-03 10:20:10 +02:00
Michael Crosby
2b97201e0c Merge pull request #22181 from Microsoft/jjh/workdir
Windows: Consistent build workdir handling
2016-04-26 16:51:09 -07:00
John Howard
0433801093 Windows: Consistent build workdir handling
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-04-26 15:32:52 -07:00
Yong Tang
5844736c14 Labels set on the command line always override labels in Dockerfile
This fix tries to address the inconsistency in #22036 where labels
set on the command line will not override labels specified in
Dockerfile, but will override labels inherited from `FROM` images.

The fix add a LABEL with command line options at the end of the
processed Dockerfile so that command line options labels always
override the LABEL in Dockerfiles (or through `FROM`).

An integration test has been added for test cases specified in #22036.

This fix fixes #22036.

NOTE: Some changes are from #22266 (@tiborvass).

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-04-23 18:49:17 -07:00
Vincent Demeester
27dd6a10b8 Merge pull request #21817 from tkopczynski/20784-builder-dockerfile-support
Unit tests for builder/dockerfile/support
2016-04-16 13:34:35 +02:00
Tomasz Kopczynski
d0ebc58b9c Unit tests for builder/dockerfile/support
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-04-16 00:19:58 +02:00
Tibor Vass
c60c3045dd Merge pull request #21633 from tkopczynski/20784-builder-tarsum-tests
Builder/tarsum unit tests
2016-04-15 12:53:07 -04:00
Tõnis Tiigi
1a14bbc61e Merge pull request #21726 from aaronlehmann/tarsum-filename-normalization
Fix build cache false positives when build context tar contains unnormalized paths
2016-04-15 09:45:26 -07:00
Aaron Lehmann
8691a77e44 Fix build cache false positives when build context tar contains unnormalized paths
If a build context tar has path names of the form 'x/./y', they will be
stored in this unnormalized form internally by tarsum. When the builder
walks the untarred directory tree and queries hashes for each relative
path, it will query paths of the form 'x/y', and they will not be found.

To correct this, have tarsum normalize path names by calling Clean.

Add a test to detect this caching false positive.

Fixes #21715

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-04-14 17:57:45 -07:00
Tõnis Tiigi
73ac6d199c Move build endpoint handler from daemon (#21972)
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-04-13 10:21:00 -07:00
Brian Goff
681b5e0ed4 Merge pull request #21867 from calavera/remove_reference_from_api
Remove reference package dependency from the api.
2016-04-07 21:56:43 -04:00
Brian Goff
3e14070c88 Merge pull request #21815 from Microsoft/jjh/fixunittest
Windows: Fix failing unit tests
2016-04-07 21:14:42 -04:00
David Calavera
47afe6bd0a Remove reference package dependency from the api.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-04-07 15:01:23 -07:00
John Howard
ccd0da908a Windows: Fix failing unit tests
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-04-06 13:42:15 -07:00
John Howard
331c8a86d4 Windows: Remove TP4 support from main code
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-04-06 12:12:20 -07:00
John Howard
f3da0c9055 Merge pull request #21669 from msabansal/expose
Enabling expose support for Windows TP5
2016-04-06 07:52:07 -07:00
msabansal
4982a732f3 Enabling expose support for Windows TP5
Signed-off-by: msabansal <sabansal@microsoft.com>
2016-03-30 17:25:41 -07:00
David Calavera
1a85c8ebbe Apply build labels to images with only a FROM tag.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-03-30 17:28:13 -04:00
Tibor Vass
8dabc0c39b Merge pull request #21574 from tkopczynski/20784-builder-context-tests
Builder/context unit tests
2016-03-30 14:04:51 -04:00
Tomasz Kopczynski
61ca9cc99e Builder/tarsum unit tests
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-03-30 06:40:40 +02:00
Tomasz Kopczynski
555d8cb293 Dockerignore tests
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
2016-03-28 22:31:35 +02:00