Fix racy integration tests

Do not run containers in the background in the integration tests if you
depend on the run completing.  It is better especially if you just want
to ensure that the run has completed with a `true` to just run in
foreground and use a known name for the container to query it after it
has stopped.

The failures can be reproduced on most machines by giving your dind
container one core and a cpushare.

docker run -c 200 --cpuset 0 -ti --rm --privileged -e
DOCKER_GRAPHDRIVER=vfs docker hack/make.sh binary test-integration-cli

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Merge pull request #8661 from estesp/8555-start-exit-code

Return container exit code with start -a/-i
Fixes #8690

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
Merge pull request #8691 from crosbymichael/fix-integration-race

Fix racy integration tests
Merge pull request #8670 from SvenDowideit/link-to-run-reference-from-cli.md

Link to run reference from cli doc
Merge pull request #8651 from flisky/patch-1

fix a small typo
Merge pull request #8680 from wilsaj/patch-1

Docfix: fix cli dashes in boot2docker resizing article
Merge pull request #8682 from wpp/update_linking_documentation

Update linking documentation
Merge pull request #8692 from jfrazelle/8690-latest-tag-problem

Fix problem where building Dockerfile `FROM name:latest`
Merge pull request #8672 from estesp/CmdRun-fix-typos-comments

Clean up comment sections and fix typos in CmdRun
Correct url from github.com/dotcloud/docker{,-py}
to github.com/docker/docker{,-py}

Signed-off-by: Torstein Husebø <torstein@huseboe.net>
Fix stdout premature EOF

Never close attached stream before both stdout and stderr have written
all their buffered contents. Remove stdinCloser because it is not needed
any more as the stream is closed anyway after attach has finished.

Fixes #3631

Signed-off-by: Andy Goldstein <agoldste@redhat.com>
Add MemInfo to the system pkg.

MemInfo provides a simple API to get memory information from the
system.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
TestRunRedirectStdout kept failing with timed out.

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
Merge pull request #8708 from torstehu/fix-url

Correct url from github.com/dotcloud/docker{,-py}
Merge pull request #8673 from SvenDowideit/whats-docker-version

DOCKER_VERSION and docker-version havn't been implemented.
Merge pull request #8718 from jfrazelle/run-redirect-test-fix

TestRunRedirectStdout kept failing with timed out.
Rewrite ENTRYPOINT documentation covering all the combinations with examples.

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@docker.com> (github: SvenDowideit)
save start error into State.Error

when a container failed to start, saves the error message into State.Error so
that it can be retrieved when calling `docker inspect` instead of having to
look at the log

Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)
Port number 49153(BeginPortRange) would be returned twice, causing duplication and potential errors.

If we first request port 49153 (BeginPortRange) explicitly, and later some time request the next free port (of same ip/proto) by calling RequestPort() with port number 0, we will again get 49153 returned, even if it's currently in use. Because findPort() blindly retured BeginPortRange the first run, without checking if it has already been taken.

Signed-off-by: shuai-z <zs.broccoli@gmail.com>