test: skip TestCreate on Fedora due to lxc utils bug

In the dind environment running on a Fedora host, the lxc utils get
confused by the /sys/fs/cgroup/cpuacct,cpu cgroup mount and lxc-start
fails trying to access the wrong cgroup directory.
test: 2 second timeout (not 2000)
test: fix races in TestReloadContainerLinks

The test wasn't actually killing the first containers before having the
runtime autostart them again, so we had 2 containers running out of the
same directory at the same time.

Also rename the containers and clean up the comments so it's a lot
clearer what's going on.
dockerinit: create a long-running dockerinit

Create a long-running dockerinit which does some setup, starts the
container app, waits for it to finish, and exits with the app's exit
code.

A long-running dockerinit is a prerequisite for using libvirt-lxc, since
libvirt provides no way to return an exit code, and no way to split
stdout and stderr into separate streams.

It also will allow docker to get rid of the ugly Ghost state, and might
even make it possible to do everything in the docker client and get rid
of the docker daemon altogether.
dockerinit: reap zombies
dockerinit: forward signals

Forward all signals received by dockerinit to the app, so that
dockerinit behaves more like the app itself.
fix container restart race condition

Finish container cleanup before setting the state to stopped.
Otherwise, for an application that exits quickly, a call to Restart
can allow Start to be called again before cleanup is done, resulting in
overritten data in the Container struct.
simplify the runtime Register reconnect logic

Refactor the Register code a little bit to make it easier to comprehend.
dockerinit: add RPC socket and Resume call

Create a per-container UNIX socket which is used for RPC communication
between the docker daemon and dockerinit.  The socket file is stored in
a bind-mounted <container root>/shared/ directory, seen as
/.docker-shared/ within the container.

Also add a Resume() RPC call which will allow docker to pause the
container startup until it's ready to resume.  This will be used in the
future to allow docker to hook up the console before resuming the
container so it doesn't miss any output.  The Resume() call will also be
needed for exit code reporting.
fix rpc file descriptor leak

Work around a bug in the Go RPC Client Close() function which returns an
error when the connection has already been closed, but doesn't close the
underlying socket FD.
dockerinit: exit code reporting

Add dockerinit RPC Wait() function that waits for the container app to
exit and returns its exit code to the docker daemon.

This is needed for using libvirt-lxc because libvirt doesn't provide the
exit code.  It will also help docker get rid of the Ghost state.
don't forward SIGCHLD to container

It makes no sense to forward SIGCHLD to the container.
dockerinit: kill support
test: fix TestRmi race condition
dockerinit: console FD passing

Move all the pty/pipe console handling into dockerinit.  Create a UNIX
socket whose sole purpose is to pass the console FDs to the docker
daemon.

This will allow us to get rid of the container Ghost state, since the
docker daemon can always reconnect to the container's console if needed.
It will also enable stdin/stdout/stderr separation when using
libvirt-lxc.
dockerinit: goodbye Ghost state

Now that we can always reconnect to dockerinit to connect to the console
and wait for the exit code, the Ghost state can go bye bye.
dockerinit: drop capabilities

Drop capabilities in dockerinit instead of with lxc utils, since
libvirt-lxc doesn't support it.

This is also needed for machine container mode.  Dockerinit needs
CAP_SYS_ADMIN to setup /dev/console correctly.
dockerinit: machine container support

Detect when the app is a "machine container" with its own init process.
In this case, since upstart and systemd require running as PID 1, the
original dockerinit will have to "fork" a child long-running dockerinit
before exec-ing the real init.
dockerinit: set hostname

Set the hostname in dockerinit instead of with lxc utils.  libvirt-lxc
doesn't have a way to do this, so do it in a common place.
dockerinit: set IP address

Set the IP address in dockerinit instead of lxc utils, to prepare for
using libvirt-lxc.