As per GitHub issue. Seems (at least to me) like weird and undocumented behaviour so posting (as requested) to see what the community thinks.
Description
Previously stopped container 1
derived from image A
that is different to the latest image B
chosen by a user from the options form is not removed when it should be in order to create container 2
. Instead, container 1
is simply restarted.
Expected behaviour
A user stopping their server and selecting image B
should cause the existing stopped container 1
based on image A
to be removed and a new container 2
created based on image B
.
Actual behaviour
A user stops their server and selects image B
but existing container 1
is restarted.
How to reproduce
With c.Spawner.remove = False
and c.Spawner.allowed_images = {image_name_a: image_a, image_name_b: image_b}
and a Lab ide.
- User clicks
Start Server
and selects imageA
in the option form - User waits for server to load.
- User goes to File > Hub Control Panel >
Stop My Server
- User clicks
Start Server
and selects imageB
in the option form - User waits for server to load.
- User is presented with the container
1
as before (original container1
is not removed)
Personally I’d argue that if a configuration option is offered then the system should handle resulting behaviour/state in a logical way, rather than weird undocumented behaviour like image B
never spawning when image B
is what the user specifically requested.
Seems a simple fix, but appreciate there could be additional complexity e.g. how does one define whether the current image is the same as previous? Image hash or name? Should one warn the user that their previous image container will be deleted permanently? What about stale Hub configurations like new container volume mounts?
Still, it’s weird for users when remove = False
and they can only ever access the first image they ever spawn, whereas “hitting everything with a hammer” aka. remove = True
means things like user apt package installations cannot be persisted and encourages users to keep their containers alive for as long as humanly possible.