integration cli: add some utility functions and use them

This PR adds functions required to run commands with timeouts and convenience functions for running Docker commands with timeouts.

It also adds a getContainerState function to make it easier to get a container's state (running, not running and its exit code if it's not running).