Refactoring Docker integration test.

Uses assert and require. Moves common components to a common file for
reuse.