shell: Fix TypeError exception when leaving docker page

Fixes #1010