refactor: extract container network configuration
and use more function parameters in preference to global vars