Defer terminal restore before starting the container so that it gets cleaned up if an error occurs
Attach to container on a separate thread before starting it