Container#AllocateNetwork: Simplify error handling.

The defer logic was a little tricky and was hiding one bug: `err` was
being redefined (with `:=`) and thus it escaped the defer error checking
logic.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
back from camping, and making fred the docs 'guy in charge'

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@docker.com> (github: SvenDowideit)
Increase the tag length limit from 30 to 128

Signed-off-by: Burke Libbey <burke.libbey@shopify.com>
Check /etc/resolv.conf every time for 127.* content

Currently if you start the docker -d on a system with 127.0.0.1 in /etc/resolv.conf
It will set the default dns to 8.8.8.8 8.8.4.4 permanently.

This causes a problem at boot on Fedora machines where NetworkManager has not
populated /etc/resolv.conf before docker gets started.

This fix checks /etc/resolv.conf on every docker run. And only populates
daemon.config.Dns  if the user specified it on the command line.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
Test for check /etc/resolv.conf on every docker run for 127.* content.

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
Merge pull request #8437 from SvenDowideit/un-pto-sven-oct-2014

back from camping, and making fred the docs 'guy in charge'
Merge pull request #8431 from aluzzardi/b-alloc-network-error-handling

Container#AllocateNetwork: Simplify error handling.
Add a best practice to reduce cache invalidations

inspired by https://github.com/docker-training/docker-fundamentals/pull/206

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
Merge pull request #8447 from burke/bump-tag-char-limit

Increase the tag length limit from 30 to 128
Fix Tag Test for longer tags

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

Fix Tag Test for longer tags
docs: Remove `Detach` parameter from Exec Create example

Signed-off-by: Fabio Rehm <fgrehm@gmail.com>
pass extra file to child process as status handler

When stdout/stderr is closed prematurely, the proxy's writes to stdout/stderr
(i.e. `log.Errorf/log.Printf`) will returns with EPIPE error, and go runtime
will terminate the proxy when stdout/stderr writes trigger 10 EPIPE errors.

instead of using stdout/stderr as the status handler, we pass an extra file to
the child process and write `0\n` or `1\nerror message` to it and close it
after. This allow the child process to handle stdout/stderr as normal.

Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)
Restore volume refs after daemon restart

Volume refs were not being restored on daemon restart.
This made it possible to remove a volume being used by other containers
after a daemon restart.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Fixes re-creating volume on (re)start

When a container is restarted all the volume configs are parsed again.
Even if the volume was already handled in a previous start it was still
calling "FindOrCreateVolume" on the volume repo causing a new volume to
be created.

This wasn't being detected because as part of the mount initialization
it checks to see if the the _mount_ was already initialized, but this
happens after the parsing of the configs.
So a check is added during parsing to skip a volume which was already
created for that container.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
merged conflicting commits

Signed-off-by: Nathan Hsieh <hsieh.nathan@gmail.com>
Squashed commit of the following:

commit 3f9e9185fe7ee51f2fe55f0fc0d4fffdc4f289dc
Author: Nathan Hsieh <hsieh.nathan@gmail.com>
Date:   Mon Oct 6 10:57:35 2014 -0700

    changed the title of back buttons

commit f86934424e85931ec293e711ceaa93ee920828fb
Author: Nathan Hsieh <hsieh.nathan@gmail.com>
Date:   Mon Oct 6 10:53:15 2014 -0700

    Finished level 2, refactored tests

commit 8f502bce05293cccaf200b69ce5f5826eee72484
Author: Nathan Hsieh <hsieh.nathan@gmail.com>
Date:   Mon Oct 6 08:52:37 2014 -0700

    stylized better and added level 2

commit 07b2276b346c34c0cc0faa57500c40e120e77888
Author: Nathan Hsieh <hsieh.nathan@gmail.com>
Date:   Fri Oct 3 18:17:29 2014 -0700

    broke tutorial tests styles

commit 35d84147dc2f65b0ffeea5faf304add903219b1e
Author: Nathan Hsieh <hsieh.nathan@gmail.com>
Date:   Fri Oct 3 17:23:48 2014 -0700

    structured test level1 md file

commit 808d01b0d55d67eb1017f290a29da6c7d38565f2
Author: Nathan Hsieh <hsieh.nathan@gmail.com>
Date:   Fri Oct 3 17:15:46 2014 -0700

    Modified files and integrated tutorial through new page

commit 0f0093f2882489c3eeb6f8870f2b8aa64dc939a3
Author: Nathan Hsieh <hsieh.nathan@gmail.com>
Date:   Thu Oct 2 14:34:44 2014 -0700

    more refactoring

commit 5a9b98e55ebd455ccf2c0ced20f984545a0b6d71
Author: Nathan Hsieh <hsieh.nathan@gmail.com>
Date:   Thu Oct 2 11:46:58 2014 -0700

    clean js code

commit af3bbd8d5e1dffdaa1780f83b909ff566906e513
Author: Nathan Hsieh <hsieh.nathan@gmail.com>
Date:   Thu Oct 2 11:26:39 2014 -0700

    level 1 cleanup

commit c4852a7766ab4fbd978d65c8352ace05eb427ef5
Author: Nathan Hsieh <hsieh.nathan@gmail.com>
Date:   Thu Oct 2 11:20:17 2014 -0700

    fixed up fill-in level1

commit 7f02d80942549dec9c05f784b777fcb32d5bb81b
Author: Nathan Hsieh <hsieh.nathan@gmail.com>
Date:   Wed Oct 1 17:45:42 2014 -0700

    added dockerfile tut, stylized lesson1 Questions

Signed-off-by: Nathan Hsieh <hsieh.nathan@gmail.com>
added fixes to address comments

Signed-off-by: Nathan Hsieh <hsieh.nathan@gmail.com>
Merge pull request #8472 from cpuguy83/fix_volume_refs_on_daemon_restore

Restore volume refs after daemon restart
Merge pull request #8475 from cpuguy83/fix_create_phantom_volumes_on_container_restart

Fixes re-creating volume on (re)start