fix: remove stale devbox container on restart#1043
Merged
Conversation
Fix 'container name already in use' error when starting devbox after the container exists in a stopped/exited state (e.g. after Docker or devbox restart). Previously _container_is_running only checked running containers via 'docker ps', so a stopped container would fall through to 'docker run' and fail on the name conflict. Add _container_exists helper using 'docker ps -a' and remove any existing container before starting a new one. Also switch the 'already running' path from 'docker stop' to 'docker rm -f' to free the name. Signed-off-by: Kevin Su <pingsutw@apache.org>
Signed-off-by: Kevin Su <pingsutw@apache.org>
Simplifies the stop+wait sequence into a single force-remove command. Signed-off-by: Kevin Su <pingsutw@apache.org>
AdilFayyaz
approved these changes
May 8, 2026
AdilFayyaz
pushed a commit
that referenced
this pull request
May 12, 2026
Signed-off-by: Kevin Su <pingsutw@apache.org> Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
samhita-alla
pushed a commit
that referenced
this pull request
May 13, 2026
Signed-off-by: Kevin Su <pingsutw@apache.org> Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
container name "/flyte-devbox" is already in useerror when runningflyte start devboxafter the container exists in a stopped/exited state (e.g. after Docker Desktop or machine restart)._container_is_runningonly checks running containers viadocker ps, so a stopped container would fall through todocker runand fail on the name conflict.docker rm -f flyte-devbox(withcheck=False) before starting, so any leftover container — running or stopped — is cleared. The "already running" prompt is preserved.Test plan
flyte start devbox, then restart Docker, thenflyte start devboxagain — should start cleanly instead of erroring.flyte start devboxwhile one is already running, answeryto the prompt — should remove and recreate.