Refactoring libcontainer to avoid cyclic dependencies in the future.

This change will make future work inside libcontainer easier since the API is separated from the internal implementation.
Can we do it in a separate PR? Also that would break docker right? I assume you will take care of the merge issues?