shell: Fix TypeError exception when leaving docker page

Fixes #1010
Closes #1017