Граф коммитов

150 Коммитов

Автор SHA1 Сообщение Дата
Guillaume J. Charmes 98ce0cdb4f
Fix remote tar ADD behavior
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
2014-02-17 17:08:17 -08:00
Alexander Larsson f198ee525a Properly close archives
All archive that are created from somewhere generally have to be closed, because
at some point there is a file or a pipe or something that backs them. So, we
make archive.Archive a ReadCloser. However, code consuming archives does not
typically close them so we add an archive.ArchiveReader and use that when we're
only reading.

We then change all the Tar/Archive places to create ReadClosers, and to properly
close them everywhere.

As an added bonus we can use ReadCloserWrapper rather than EofReader in several places,
which is good as EofReader doesn't always work right. For instance, many compression
schemes like gzip knows it is EOF before having read the EOF from the stream, so the
EofCloser never sees an EOF.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-14 13:46:17 +01:00
unclejack 1b8ec8ff1d Merge pull request #4134 from crosbymichael/fix-add-magic-regression
Fix regression with ADD of tar files
2014-02-14 03:43:39 +02:00
Michael Crosby cad7f7ee50 Fix regression with ADD of tar files
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-02-13 17:18:38 -08:00
Victor Vieux 6f10f33387 Merge pull request #4103 from vieux/add_error_build-rm
add error to docker build --rm
2014-02-13 10:35:55 -08:00
Victor Vieux a895c7238d add error to docekr build --rm
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
2014-02-12 23:23:42 +00:00
Alexander Larsson 59347fa66d Avoid extra mount/unmount during build
CmdRun() calls first run() and then wait() to wait for it to exit,
then it runs commit(). The run command will mount the container and
the container exiting will unmount it. Then the commit will
immediately mount it again to do a diff.

This seems minor, but this is actually problematic, as the Get/Put
pair will create a spurious mount/unmount cycle that is not needed and
slows things down. Additionally it will create a supurious
devicemapper activate/deactivate cycle that causes races with udev as
seen in https://github.com/dotcloud/docker/issues/4036.

To ensure that we only unmount once we split up run() into create()
and run() and reference the mount until after the commit().

With this change docker build on devicemapper is now race-free, and
slightly faster.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-12 16:02:53 +01:00
Solomon Hykes 6393c38339 Move the canonical run configuration objects to a sub-package
* Config is now runconfig.Config
    * HostConfig is now runconfig.HostConfig
    * MergeConfig is now runconfig.Merge
    * CompareConfig is now runconfig.Compare
    * ParseRun is now runconfig.Parse
    * ContainerConfigFromJob is now runconfig.ContainerConfigFromJob
    * ContainerHostConfigFromJob is now runconfig.ContainerHostConfigFromJob

This facilitates refactoring commands.go and shrinks the core.

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
2014-02-11 20:18:46 -08:00
Solomon Hykes ded9e0d6df builder: clearly display ONBUILD triggers during a build.
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
2014-02-04 19:11:56 +00:00
Solomon Hykes 9f994c9646 New build instruction: ONBUILD defines a trigger to execute when extending an image with a new build
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
2014-02-04 01:31:19 +00:00
Solomon Hykes a51f5a287b Builder: extract the execution of a single build step into buildFile.BuildStep
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
2014-02-04 01:23:01 +00:00
Alexander Larsson fab19d197c Separate out graphdriver mount and container root
This separates out the directory as returned from the graphdriver (the
"base" fs) from the root filesystem of the live container. This is
necessary as the "diff" operation needs access to the base filesystem
without all the mounts that the running container needs (/.dockerinit,
volumes, etc).

We change container in the following way:

Container.RootfsPath() returns the the directory which will be used as
the root in a running container. It is always of the form
"/var/lib/docker/container/<id>/root" and is a private bind mount to
the base filesystem. It is only available while the container is running.

Container.BasefsPath() returns the raw directory from the graph driver
without the container runtime mounts. It is availible whenever the
container is mounted (in between a container.Mount()/Unmount() pair,
which are properly refcounted).

This fixes issue #3840

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-01-30 16:43:53 +01:00
Victor Vieux 9dcbdbc4b1 move pull and import to a job
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
2014-01-24 14:46:31 -08:00
Michael Crosby 2a6e93a6fb Merge pull request #3558 from tianon/buildfile-run-json
Add support for RUN [""] in Dockerfiles
2014-01-22 11:51:34 -08:00
Alexander Larsson 191aa17d16 Remove container.EnsureMounted
This was deprecated already and all it did was call Mount().
The use of this was a bit confusing since we need to pair Mount/Unmount
calls which wasn't obvious with "EnsureMounted".

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-01-21 11:26:11 +01:00
Jake Moshenko 6e6ff85362 Fix support for registry auth with Dockerfile build.
Docker-DCO-1.1-Signed-off-by: Jake Moshenko <jake@devtable.com> (github: jakedt)
2014-01-20 18:35:14 -05:00
Gereon Frey 4f53722dee detect compressed archives in API /build call
AFAIK in some previous version it was possible to give a compressed docker file
to the API's build command and that was handled properly (aka compression was
detected and archive uncompressed accordingly). Fails with at least 0.7.5.

Fixed this using the DecompressStream method from the archive package.

Docker-DCO-1.1-Signed-off-by: Gereon Frey <me@gereonfrey.de> (github: gfrey)
2014-01-17 12:21:26 +01:00
Tianon Gravi 7a6255efbc Fix "foo: no such file or directory" test failure, and normalize creation of custom error to always depend on if os.IsNotExist(err) so we don't hide other errors that might crop up in these tests
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
2014-01-14 11:42:03 -07:00
Tianon Gravi fb63cfa9a5 Stop ADD from following symlinks outside the context when passed as the first argument
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
2014-01-11 05:46:11 -07:00
Tianon Gravi fd78128870 Add support for `RUN [""]` in Dockerfiles for greater specificity in what is actually executed
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
2014-01-11 04:00:52 -07:00
Guillaume J. Charmes 0fd9c98de3 Make sure the remote ADD are cached properly
Docker-DCO-1.0-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
2014-01-08 14:22:49 -08:00
Guillaume J. Charmes e24e9c09f8 Make sure file are cached correctly during build
Docker-DCO-1.0-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
2014-01-08 14:22:49 -08:00
Frank Macreery 93ff70a3e7
Potential fix for ADD .
Docker-DCO-1.0-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
2014-01-08 14:22:24 -08:00
Guillaume J. Charmes c6350bcc24 Disable compression for build. More space usage but much faster upload
Docker-DCO-1.0-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
2014-01-08 14:21:13 -08:00
Guillaume J. Charmes f3103e5c91
Fix issue with file caching + prevent wrong cache hit
Docker-DCO-1.0-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
2014-01-07 16:53:55 -08:00
Guillaume J. Charmes 811341423b
Fix ADD caching issue with . prefixed path
Docker-DCO-1.0-Signed-off-by: Guillaume J. Charmes <charmes.guillaume@gmail.com> (github: creack)
2014-01-07 16:02:20 -08:00
Michael Crosby ee6823d797 Merge pull request #3297 from jaseg/master
Return meaningful error for meaningless Dockerfiles
2014-01-06 10:58:24 -08:00
Victor Vieux e5b09523dc Merge pull request #3367 from cpuguy83/3362-unify_cmd_entrypoint_handling
Use same error handling while unmarshalling args for CMD and ENTRYPOINT
2014-01-06 10:29:37 -08:00
Brian Goff 323c4b5211 Use same error handling while unmarshalling args for CMD and ENTRYPOINT 2014-01-06 13:15:14 -05:00
Guillaume J. Charmes cd735496da
Hash the sums for directory (ureadable when there is too many 2013-12-26 16:42:05 -08:00
Guillaume J. Charmes 894d4a23fb
Change BuildFile in order to use TarSum instead of custom checksum 2013-12-26 16:16:26 -08:00
Guillaume J. Charmes efaf2cac5c Merge pull request #2809 from graydon/880-cache-ADD-commands-in-dockerfiles
Issue #880 - cache ADD commands in dockerfiles
2013-12-24 16:22:51 -08:00
jaseg b8cd2bc94d Return meaningful error for meaningless Dockerfiles 2013-12-20 16:19:21 +01:00
Johannes 'fish' Ziemke f7ba1c34bb Return error if Dockerfile is empty 2013-12-20 14:13:52 +01:00
Graydon Hoare 3f9416b58d Record added-tree sha256 in buildfile.CmdAdd, probe and use cache. 2013-12-16 17:36:51 -08:00
Graydon Hoare 7afd7a82bd Factor cache-probing logic out of buildfile.commit() and CmdRun(). 2013-12-16 17:36:50 -08:00
Guillaume J. Charmes b3ad330782 Merge pull request #3099 from vieux/fix_pull_build
added authConfig to docker build
2013-12-16 10:53:10 -08:00
Victor Vieux 228091c79e added authConfig to docker build 2013-12-06 14:27:10 -08:00
Victor Vieux 05f416d869 fix jsonmessage in build 2013-12-06 14:09:27 -08:00
Victor Vieux 12180948be remove unused parameter in Download 2013-12-04 11:54:11 -08:00
Guillaume J. Charmes de4429f70d
Do not format at each write but use a Writer instead (build) 2013-12-02 11:43:41 -08:00
Michael Crosby fe571dd293 Merge pull request #2829 from dotcloud/refactor_opts
Refactor opts
2013-12-02 10:41:30 -08:00
Johannes 'fish' Ziemke b04c6466cd Make docker build return exit code of build step
If a command during build fails, `docker build` now returns with
the exit code of that command.

This makes it necessary to change the build api endpoint to
return a json object stream.
2013-12-02 17:52:37 +01:00
Victor Vieux 926f7b579e Merge pull request #2692 from SvenDowideit/add-specific-feedback-for-bad-ADD
Add specific feedback for ADD outside context
2013-11-28 17:55:11 -08:00
Guillaume J. Charmes 1ba11384bf Refactor Opts 2013-11-26 17:46:06 +00:00
Solomon Hykes 43c7df946d Merge branch 'master' into 0.6.5-dm-plugin 2013-11-26 02:00:25 +00:00
Sven Dowideit 96b5be9dd9 add more searchable info to the error message when ADD tries to go outside the context 2013-11-23 12:23:31 +10:00
Guillaume J. Charmes c67f9b671d
Remove useless New*Opt functions, singleline Opt types 2013-11-22 14:42:30 -08:00
Michael Crosby 5d9723002b Allow drivers to implement ApplyDiff in Differ interface 2013-11-11 19:09:57 -08:00
Michael Crosby 99141ea3ca Use parent image config in buildfile 2013-11-04 13:20:14 -08:00