Add dockerfile pod template and fix state transition bugs

Does this imply a third state?