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)
CompressStream() now always returns a stream that is closable, and it never
closes the underlying writer. TarFilter() makes sure the decompressed stream
is closed at the and, as well as the PipeWriter.
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Various kinds of decompressed streams are really ReadClosers. For instance
gzip.NewReader() is, and the one returned from CmdStream is changed to be
because it returns a PipeReader which is a ReadCloser.
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
This stops docker from accepting tcp:// as a valid bind address.
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
* master: (64 commits)
Move the canonical run configuration objects to a sub-package
Remove useless code in client implementation of 'run'.
pkg/opts: a collection of custom value parsers implementing flag.Value
Move api-specific code to the api package
Fix the tests, too
Fix the one spot I missed dockerversion
fix underline/heading
New package `nat`: utilities for manipulating the text description of network ports.
rewrite the PostgreSQL example using a Dockerfile, and add details to it
Move even more stuff into dockerversion
fix underline/heading
Move docker version introspection to a sub-package.
add port forwarding notes for mac/boot2docker docs
Update remote_api_client_libraries.rst
Avoid extra mount/unmount during container registration
add a little more information about the docker run -P option
lxc: Drop NET_ADMIN capability in non-privileged containers
devmapper: Remove directory when removing devicemapper device
add a little info on upgrading
point out that ENV DEBIAN_FRONTEND will persist, so its not recommended
...
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)